2
0
Эх сурвалжийг харах

Properly export all lua-facing functions and use those for initialization (love.cpp no longer explicitly mentions implementations)

Bart van Strien 13 жил өмнө
parent
commit
c707a4ca45
85 өөрчлөгдсөн 119 нэмэгдсэн , 114 устгасан
  1. 33 28
      src/love.cpp
  2. 1 1
      src/modules/audio/wrap_Audio.cpp
  3. 1 1
      src/modules/audio/wrap_Source.cpp
  4. 1 1
      src/modules/audio/wrap_Source.h
  5. 1 1
      src/modules/event/sdl/wrap_Event.cpp
  6. 1 1
      src/modules/filesystem/physfs/wrap_File.cpp
  7. 1 1
      src/modules/filesystem/physfs/wrap_File.h
  8. 1 1
      src/modules/filesystem/physfs/wrap_FileData.cpp
  9. 1 1
      src/modules/filesystem/physfs/wrap_FileData.h
  10. 1 1
      src/modules/filesystem/physfs/wrap_Filesystem.cpp
  11. 1 1
      src/modules/font/freetype/wrap_Font.cpp
  12. 1 1
      src/modules/font/wrap_GlyphData.cpp
  13. 1 1
      src/modules/font/wrap_GlyphData.h
  14. 1 1
      src/modules/font/wrap_Rasterizer.cpp
  15. 1 1
      src/modules/font/wrap_Rasterizer.h
  16. 1 1
      src/modules/graphics/opengl/wrap_Canvas.cpp
  17. 1 1
      src/modules/graphics/opengl/wrap_Canvas.h
  18. 1 1
      src/modules/graphics/opengl/wrap_Font.cpp
  19. 1 1
      src/modules/graphics/opengl/wrap_Font.h
  20. 1 1
      src/modules/graphics/opengl/wrap_Graphics.cpp
  21. 1 1
      src/modules/graphics/opengl/wrap_Image.cpp
  22. 1 1
      src/modules/graphics/opengl/wrap_Image.h
  23. 1 1
      src/modules/graphics/opengl/wrap_ParticleSystem.cpp
  24. 1 1
      src/modules/graphics/opengl/wrap_ParticleSystem.h
  25. 1 1
      src/modules/graphics/opengl/wrap_PixelEffect.cpp
  26. 1 1
      src/modules/graphics/opengl/wrap_PixelEffect.h
  27. 1 1
      src/modules/graphics/opengl/wrap_Quad.cpp
  28. 1 1
      src/modules/graphics/opengl/wrap_Quad.h
  29. 1 1
      src/modules/graphics/opengl/wrap_SpriteBatch.cpp
  30. 1 1
      src/modules/graphics/opengl/wrap_SpriteBatch.h
  31. 1 1
      src/modules/image/wrap_Image.cpp
  32. 1 1
      src/modules/image/wrap_ImageData.cpp
  33. 1 1
      src/modules/image/wrap_ImageData.h
  34. 1 1
      src/modules/joystick/sdl/wrap_Joystick.cpp
  35. 1 1
      src/modules/keyboard/wrap_Keyboard.cpp
  36. 1 1
      src/modules/mouse/wrap_Mouse.cpp
  37. 1 1
      src/modules/physics/box2d/wrap_Body.cpp
  38. 1 1
      src/modules/physics/box2d/wrap_Body.h
  39. 1 1
      src/modules/physics/box2d/wrap_ChainShape.cpp
  40. 1 1
      src/modules/physics/box2d/wrap_ChainShape.h
  41. 2 2
      src/modules/physics/box2d/wrap_CircleShape.cpp
  42. 1 1
      src/modules/physics/box2d/wrap_CircleShape.h
  43. 1 1
      src/modules/physics/box2d/wrap_Contact.cpp
  44. 1 1
      src/modules/physics/box2d/wrap_Contact.h
  45. 1 1
      src/modules/physics/box2d/wrap_DistanceJoint.cpp
  46. 1 1
      src/modules/physics/box2d/wrap_DistanceJoint.h
  47. 1 1
      src/modules/physics/box2d/wrap_EdgeShape.cpp
  48. 1 1
      src/modules/physics/box2d/wrap_EdgeShape.h
  49. 1 1
      src/modules/physics/box2d/wrap_Fixture.cpp
  50. 1 1
      src/modules/physics/box2d/wrap_Fixture.h
  51. 1 1
      src/modules/physics/box2d/wrap_FrictionJoint.cpp
  52. 1 1
      src/modules/physics/box2d/wrap_FrictionJoint.h
  53. 1 1
      src/modules/physics/box2d/wrap_GearJoint.cpp
  54. 1 1
      src/modules/physics/box2d/wrap_GearJoint.h
  55. 1 1
      src/modules/physics/box2d/wrap_Joint.cpp
  56. 1 1
      src/modules/physics/box2d/wrap_Joint.h
  57. 1 1
      src/modules/physics/box2d/wrap_MouseJoint.cpp
  58. 1 1
      src/modules/physics/box2d/wrap_MouseJoint.h
  59. 1 1
      src/modules/physics/box2d/wrap_Physics.cpp
  60. 1 1
      src/modules/physics/box2d/wrap_PolygonShape.cpp
  61. 1 1
      src/modules/physics/box2d/wrap_PolygonShape.h
  62. 1 1
      src/modules/physics/box2d/wrap_PrismaticJoint.cpp
  63. 1 1
      src/modules/physics/box2d/wrap_PrismaticJoint.h
  64. 1 1
      src/modules/physics/box2d/wrap_PulleyJoint.cpp
  65. 1 1
      src/modules/physics/box2d/wrap_PulleyJoint.h
  66. 1 1
      src/modules/physics/box2d/wrap_RevoluteJoint.cpp
  67. 1 1
      src/modules/physics/box2d/wrap_RevoluteJoint.h
  68. 1 1
      src/modules/physics/box2d/wrap_RopeJoint.cpp
  69. 1 1
      src/modules/physics/box2d/wrap_RopeJoint.h
  70. 1 1
      src/modules/physics/box2d/wrap_Shape.cpp
  71. 1 1
      src/modules/physics/box2d/wrap_Shape.h
  72. 1 1
      src/modules/physics/box2d/wrap_WeldJoint.cpp
  73. 1 1
      src/modules/physics/box2d/wrap_WeldJoint.h
  74. 1 1
      src/modules/physics/box2d/wrap_WheelJoint.cpp
  75. 1 1
      src/modules/physics/box2d/wrap_WheelJoint.h
  76. 1 1
      src/modules/physics/box2d/wrap_World.cpp
  77. 1 1
      src/modules/physics/box2d/wrap_World.h
  78. 1 1
      src/modules/sound/wrap_Decoder.cpp
  79. 1 1
      src/modules/sound/wrap_Decoder.h
  80. 1 1
      src/modules/sound/wrap_Sound.cpp
  81. 1 1
      src/modules/sound/wrap_SoundData.cpp
  82. 1 1
      src/modules/sound/wrap_SoundData.h
  83. 2 2
      src/modules/thread/wrap_Thread.cpp
  84. 1 1
      src/modules/thread/wrap_Thread.h
  85. 1 1
      src/modules/timer/wrap_Timer.cpp

+ 33 - 28
src/love.cpp

@@ -39,21 +39,6 @@
 // SDL
 #include <SDL.h>
 
-// Modules
-#include <audio/wrap_Audio.h>
-#include <event/sdl/wrap_Event.h>
-#include <filesystem/physfs/wrap_Filesystem.h>
-#include <font/freetype/wrap_Font.h>
-#include <graphics/opengl/wrap_Graphics.h>
-#include <image/wrap_Image.h>
-#include <joystick/sdl/wrap_Joystick.h>
-#include <keyboard/wrap_Keyboard.h>
-#include <mouse/wrap_Mouse.h>
-#include <physics/box2d/wrap_Physics.h>
-#include <sound/wrap_Sound.h>
-#include <timer/wrap_Timer.h>
-#include <thread/wrap_Thread.h>
-
 // Libraries.
 #include "libraries/luasocket/luasocket.h"
 
@@ -64,20 +49,40 @@
 
 #ifdef LOVE_BUILD_STANDALONE
 
+// All modules define a c-accessible luaopen
+// so let's make use of those, instead
+// of addressing implementations directly.
+extern "C"
+{
+	extern int luaopen_love_audio(lua_State*);
+	extern int luaopen_love_event(lua_State*);
+	extern int luaopen_love_filesystem(lua_State*);
+	extern int luaopen_love_font(lua_State*);
+	extern int luaopen_love_graphics(lua_State*);
+	extern int luaopen_love_image(lua_State*);
+	extern int luaopen_love_joystick(lua_State*);
+	extern int luaopen_love_keyboard(lua_State*);
+	extern int luaopen_love_mouse(lua_State*);
+	extern int luaopen_love_physics(lua_State*);
+	extern int luaopen_love_sound(lua_State*);
+	extern int luaopen_love_timer(lua_State*);
+	extern int luaopen_love_thread(lua_State*);
+}
+
 static const luaL_Reg modules[] = {
-	{ "love.audio", love::audio::luaopen_love_audio },
-	{ "love.event", love::event::sdl::luaopen_love_event },
-	{ "love.filesystem", love::filesystem::physfs::luaopen_love_filesystem },
-	{ "love.font", love::font::freetype::luaopen_love_font },
-	{ "love.graphics", love::graphics::opengl::luaopen_love_graphics },
-	{ "love.image", love::image::luaopen_love_image },
-	{ "love.joystick", love::joystick::sdl::luaopen_love_joystick },
-	{ "love.keyboard", love::keyboard::luaopen_love_keyboard },
-	{ "love.mouse", love::mouse::luaopen_love_mouse },
-	{ "love.physics", love::physics::box2d::luaopen_love_physics },
-	{ "love.sound", love::sound::luaopen_love_sound },
-	{ "love.timer", love::timer::luaopen_love_timer },
-	{ "love.thread", love::thread::luaopen_love_thread },
+	{ "love.audio", luaopen_love_audio },
+	{ "love.event", luaopen_love_event },
+	{ "love.filesystem", luaopen_love_filesystem },
+	{ "love.font", luaopen_love_font },
+	{ "love.graphics", luaopen_love_graphics },
+	{ "love.image", luaopen_love_image },
+	{ "love.joystick", luaopen_love_joystick },
+	{ "love.keyboard", luaopen_love_keyboard },
+	{ "love.mouse", luaopen_love_mouse },
+	{ "love.physics", luaopen_love_physics },
+	{ "love.sound", luaopen_love_sound },
+	{ "love.timer", luaopen_love_timer },
+	{ "love.thread", luaopen_love_thread },
 	{ 0, 0 }
 };
 

+ 1 - 1
src/modules/audio/wrap_Audio.cpp

@@ -266,7 +266,7 @@ namespace audio
 		0
 	};
 
-	int luaopen_love_audio(lua_State * L)
+	extern "C" int luaopen_love_audio(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/audio/wrap_Source.cpp

@@ -244,7 +244,7 @@ namespace audio
 		{ 0, 0 }
 	};
 
-	int luaopen_source(lua_State * L)
+	extern "C" int luaopen_source(lua_State * L)
 	{
 		return luax_register_type(L, "Source", functions);
 	}

+ 1 - 1
src/modules/audio/wrap_Source.h

@@ -51,7 +51,7 @@ namespace audio
 	int w_Source_isStopped(lua_State * L);
 	int w_Source_isPaused(lua_State * L);
 	int w_Source_isStatic(lua_State * L);
-	int luaopen_source(lua_State * L);
+	extern "C" int luaopen_source(lua_State * L);
 
 } // audio
 } // love

+ 1 - 1
src/modules/event/sdl/wrap_Event.cpp

@@ -115,7 +115,7 @@ namespace sdl
 		{ 0, 0 }
 	};
 
-	int luaopen_love_event(lua_State * L)
+	extern "C" int luaopen_love_event(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/filesystem/physfs/wrap_File.cpp

@@ -204,7 +204,7 @@ namespace physfs
 			{ 0, 0 }
 	};
 
-	int luaopen_file(lua_State * L)
+	extern "C" int luaopen_file(lua_State * L)
 	{
 		return luax_register_type(L, "File", functions);
 	}

+ 1 - 1
src/modules/filesystem/physfs/wrap_File.h

@@ -42,7 +42,7 @@ namespace physfs
 	int w_File_tell(lua_State * L);
 	int w_File_seek(lua_State * L);
 	int w_File_lines(lua_State * L);
-	int luaopen_file(lua_State * L);
+	extern "C" int luaopen_file(lua_State * L);
 } // physfs
 } // filesystem
 } // love

+ 1 - 1
src/modules/filesystem/physfs/wrap_FileData.cpp

@@ -59,7 +59,7 @@ namespace physfs
 		{ 0, 0 }
 	};
 
-	int luaopen_filedata(lua_State * L)
+	extern "C" int luaopen_filedata(lua_State * L)
 	{
 		return luax_register_type(L, "FileData", w_FileData_functions);
 	}

+ 1 - 1
src/modules/filesystem/physfs/wrap_FileData.h

@@ -35,7 +35,7 @@ namespace physfs
 	FileData * luax_checkfiledata(lua_State * L, int idx);
 	int w_FileData_getFilename(lua_State * L);
 	int w_FileData_getExtension(lua_State * L);
-	int luaopen_filedata(lua_State * L);
+	extern "C" int luaopen_filedata(lua_State * L);
 } // physfs
 } // filesystem
 } // love

+ 1 - 1
src/modules/filesystem/physfs/wrap_Filesystem.cpp

@@ -383,7 +383,7 @@ namespace physfs
 		0
 	};
 
-	int luaopen_love_filesystem(lua_State * L)
+	extern "C" int luaopen_love_filesystem(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/font/freetype/wrap_Font.cpp

@@ -79,7 +79,7 @@ namespace freetype
 		0
 	};
 
-	int luaopen_love_font(lua_State * L)
+	extern "C" int luaopen_love_font(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/font/wrap_GlyphData.cpp

@@ -35,7 +35,7 @@ namespace font
 		{ 0, 0 }
 	};
 
-	int luaopen_glyphdata(lua_State * L)
+	extern "C" int luaopen_glyphdata(lua_State * L)
 	{
 		return luax_register_type(L, "GlyphData", functions);
 	}

+ 1 - 1
src/modules/font/wrap_GlyphData.h

@@ -32,7 +32,7 @@ namespace love
 namespace font
 {
 	GlyphData * luax_checkglyphdata(lua_State * L, int idx);
-	int luaopen_glyphdata(lua_State * L);
+	extern "C" int luaopen_glyphdata(lua_State * L);
 
 } // font
 } // love

+ 1 - 1
src/modules/font/wrap_Rasterizer.cpp

@@ -35,7 +35,7 @@ namespace font
 		{ 0, 0 }
 	};
 
-	int luaopen_rasterizer(lua_State * L)
+	extern "C" int luaopen_rasterizer(lua_State * L)
 	{
 		return luax_register_type(L, "Rasterizer", functions);
 	}

+ 1 - 1
src/modules/font/wrap_Rasterizer.h

@@ -30,7 +30,7 @@ namespace love
 namespace font
 {
 	Rasterizer * luax_checkrasterizer(lua_State * L, int idx);
-	int luaopen_rasterizer(lua_State * L);
+	extern "C" int luaopen_rasterizer(lua_State * L);
 
 } // font
 } // love

+ 1 - 1
src/modules/graphics/opengl/wrap_Canvas.cpp

@@ -193,7 +193,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_canvas(lua_State * L)
+	extern "C" int luaopen_canvas(lua_State * L)
 	{
 		return luax_register_type(L, "Canvas", functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_Canvas.h

@@ -42,7 +42,7 @@ namespace opengl
 	int w_Canvas_clear(lua_State * L);
 	int w_Canvas_getWidth(lua_State * L);
 	int w_Canvas_getHeight(lua_State * L);
-	int luaopen_canvas(lua_State * L);
+	extern "C" int luaopen_canvas(lua_State * L);
 
 } // opengl
 } // graphics

+ 1 - 1
src/modules/graphics/opengl/wrap_Font.cpp

@@ -98,7 +98,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_font(lua_State * L)
+	extern "C" int luaopen_font(lua_State * L)
 	{
 		return luax_register_type(L, "Font", functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_Font.h

@@ -37,7 +37,7 @@ namespace opengl
 	int w_Font_getWrap(lua_State * L);
 	int w_Font_setLineHeight(lua_State * L);
 	int w_Font_getLineHeight(lua_State * L);
-	int luaopen_font(lua_State * L);
+	extern "C" int luaopen_font(lua_State * L);
 
 } // opengl
 } // graphics

+ 1 - 1
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -1274,7 +1274,7 @@ namespace opengl
 		0
 	};
 
-	int luaopen_love_graphics(lua_State * L)
+	extern "C" int luaopen_love_graphics(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/graphics/opengl/wrap_Image.cpp

@@ -124,7 +124,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_image(lua_State * L)
+	extern "C" int luaopen_image(lua_State * L)
 	{
 		return luax_register_type(L, "Image", functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_Image.h

@@ -35,7 +35,7 @@ namespace opengl
 	int w_Image_getWidth(lua_State * L);
 	int w_Image_getHeight(lua_State * L);
 	int w_Image_setFilter(lua_State * L);
-	int luaopen_image(lua_State * L);
+	extern "C" int luaopen_image(lua_State * L);
 
 } // opengl
 } // graphics

+ 1 - 1
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -386,7 +386,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_particlesystem(lua_State * L)
+	extern "C" int luaopen_particlesystem(lua_State * L)
 	{
 		return luax_register_type(L, "ParticleSystem", functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_ParticleSystem.h

@@ -68,7 +68,7 @@ namespace opengl
 	int w_ParticleSystem_isEmpty(lua_State * L);
 	int w_ParticleSystem_isFull(lua_State * L);
 	int w_ParticleSystem_update(lua_State * L);
-	int luaopen_particlesystem(lua_State * L);
+	extern "C" int luaopen_particlesystem(lua_State * L);
 
 } // opengl
 } // graphics

+ 1 - 1
src/modules/graphics/opengl/wrap_PixelEffect.cpp

@@ -229,7 +229,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_pixeleffect(lua_State * L)
+	extern "C" int luaopen_pixeleffect(lua_State * L)
 	{
 		return luax_register_type(L, "PixelEffect", functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_PixelEffect.h

@@ -35,7 +35,7 @@ namespace opengl
 	int w_PixelEffect_sendFloat(lua_State * L);
 	int w_PixelEffect_sendMatrix(lua_State * L);
 	int w_PixelEffect_sendImage(lua_State * L);
-	int luaopen_pixeleffect(lua_State * L);
+	extern "C" int luaopen_pixeleffect(lua_State * L);
 } // opengl
 } // graphics
 } // love

+ 1 - 1
src/modules/graphics/opengl/wrap_Quad.cpp

@@ -69,7 +69,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_frame(lua_State * L)
+	extern "C" int luaopen_frame(lua_State * L)
 	{
 		return luax_register_type(L, "Quad", w_Quad_functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_Quad.h

@@ -35,7 +35,7 @@ namespace opengl
 	int w_Quad_flip(lua_State *L);
 	int w_Quad_setViewport(lua_State * L);
 	int w_Quad_getViewport(lua_State * L);
-	int luaopen_frame(lua_State * L);
+	extern "C" int luaopen_frame(lua_State * L);
 
 } // opengl
 } // graphics

+ 1 - 1
src/modules/graphics/opengl/wrap_SpriteBatch.cpp

@@ -161,7 +161,7 @@ namespace opengl
 		{ 0, 0 }
 	};
 
-	int luaopen_spritebatch(lua_State * L)
+	extern "C" int luaopen_spritebatch(lua_State * L)
 	{
 		return luax_register_type(L, "SpriteBatch", functions);
 	}

+ 1 - 1
src/modules/graphics/opengl/wrap_SpriteBatch.h

@@ -40,7 +40,7 @@ namespace opengl
 	int w_SpriteBatch_unlock(lua_State * L);
 	int w_SpriteBatch_setImage(lua_State * L);
 
-	int luaopen_spritebatch(lua_State * L);
+	extern "C" int luaopen_spritebatch(lua_State * L);
 
 } // opengl
 } // graphics

+ 1 - 1
src/modules/image/wrap_Image.cpp

@@ -101,7 +101,7 @@ namespace image
 		0
 	};
 
-	int luaopen_love_image(lua_State * L)
+	extern "C" int luaopen_love_image(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/image/wrap_ImageData.cpp

@@ -188,7 +188,7 @@ namespace image
 		{ 0, 0 }
 	};
 
-	int luaopen_imagedata(lua_State * L)
+	extern "C" int luaopen_imagedata(lua_State * L)
 	{
 		return luax_register_type(L, "ImageData", functions);
 	}

+ 1 - 1
src/modules/image/wrap_ImageData.h

@@ -38,7 +38,7 @@ namespace image
 	int w_ImageData_getString(lua_State * L);
 	int w_ImageData_paste(lua_State * L);
 	int w_ImageData_encode(lua_State * L);
-	int luaopen_imagedata(lua_State * L);
+	extern "C" int luaopen_imagedata(lua_State * L);
 
 } // image
 } // love

+ 1 - 1
src/modules/joystick/sdl/wrap_Joystick.cpp

@@ -161,7 +161,7 @@ namespace sdl
 		{ 0, 0 }
 	};
 
-	int luaopen_love_joystick(lua_State * L)
+	extern "C" int luaopen_love_joystick(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/keyboard/wrap_Keyboard.cpp

@@ -79,7 +79,7 @@ namespace keyboard
 		{ 0, 0 }
 	};
 
-	int luaopen_love_keyboard(lua_State * L)
+	extern "C" int luaopen_love_keyboard(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/mouse/wrap_Mouse.cpp

@@ -118,7 +118,7 @@ namespace mouse
 		{ 0, 0 }
 	};
 
-	int luaopen_love_mouse(lua_State * L)
+	extern "C" int luaopen_love_mouse(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/physics/box2d/wrap_Body.cpp

@@ -573,7 +573,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_body(lua_State * L)
+	extern "C" int luaopen_body(lua_State * L)
 	{
 		return luax_register_type(L, "Body", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_Body.h

@@ -84,7 +84,7 @@ namespace box2d
 	int w_Body_isFixedRotation(lua_State * L);
 	int w_Body_getFixtureList(lua_State * L);
 	int w_Body_destroy(lua_State * L);
-	int luaopen_body(lua_State * L);
+	extern "C" int luaopen_body(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_ChainShape.cpp

@@ -118,7 +118,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_chainshape(lua_State * L)
+	extern "C" int luaopen_chainshape(lua_State * L)
 	{
 		return luax_register_type(L, "ChainShape", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_ChainShape.h

@@ -42,7 +42,7 @@ namespace box2d
 	int w_ChainShape_getPoint(lua_State * L);
 	int w_ChainShape_getPoints(lua_State * L);
 
-	int luaopen_chainshape(lua_State * L);
+	extern "C" int luaopen_chainshape(lua_State * L);
 
 } // box2d
 } // physics

+ 2 - 2
src/modules/physics/box2d/wrap_CircleShape.cpp

@@ -39,7 +39,7 @@ namespace box2d
 	}
 
 	int w_CircleShape_setRadius(lua_State * L)
-    {
+	{
         CircleShape * c = luax_checkcircleshape(L, 1);
         float r = (float)luaL_checknumber(L, 2);
 		c->setRadius(r);
@@ -61,7 +61,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_circleshape(lua_State * L)
+	extern "C" int luaopen_circleshape(lua_State * L)
 	{
 		return luax_register_type(L, "CircleShape", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_CircleShape.h

@@ -35,7 +35,7 @@ namespace box2d
 	CircleShape * luax_checkcircleshape(lua_State * L, int idx);
 	int w_CircleShape_getRadius(lua_State * L);
 	int w_CircleShape_setRadius(lua_State * L);
-	int luaopen_circleshape(lua_State * L);
+	extern "C" int luaopen_circleshape(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_Contact.cpp

@@ -110,7 +110,7 @@ namespace box2d
 		return 0;
 	}
 
-	int luaopen_contact(lua_State * L)
+	extern "C" int luaopen_contact(lua_State * L)
 	{
 		static const luaL_Reg functions[] = {
 			{ "getPositions", w_Contact_getPositions },

+ 1 - 1
src/modules/physics/box2d/wrap_Contact.h

@@ -43,7 +43,7 @@ namespace box2d
 	int w_Contact_setEnabled(lua_State * L);
 	int w_Contact_resetFriction(lua_State * L);
 	int w_Contact_resetRestitution(lua_State * L);
-	int luaopen_contact(lua_State * L);
+	extern "C" int luaopen_contact(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_DistanceJoint.cpp

@@ -93,7 +93,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_distancejoint(lua_State * L)
+	extern "C" int luaopen_distancejoint(lua_State * L)
 	{
 		return luax_register_type(L, "DistanceJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_DistanceJoint.h

@@ -39,7 +39,7 @@ namespace box2d
 	int w_DistanceJoint_getFrequency(lua_State * L);
 	int w_DistanceJoint_setDampingRatio(lua_State * L);
 	int w_DistanceJoint_getDampingRatio(lua_State * L);
-	int luaopen_distancejoint(lua_State * L);
+	extern "C" int luaopen_distancejoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_EdgeShape.cpp

@@ -52,7 +52,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_edgeshape(lua_State * L)
+	extern "C" int luaopen_edgeshape(lua_State * L)
 	{
 		return luax_register_type(L, "EdgeShape", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_EdgeShape.h

@@ -34,7 +34,7 @@ namespace box2d
 {
 	EdgeShape * luax_checkedgeshape(lua_State * L, int idx);
 	int w_EdgeShape_getPoints(lua_State * L);
-	int luaopen_edgeshape(lua_State * L);
+	extern "C" int luaopen_edgeshape(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_Fixture.cpp

@@ -289,7 +289,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_fixture(lua_State * L)
+	extern "C" int luaopen_fixture(lua_State * L)
 	{
 		return luax_register_type(L, "Fixture", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_Fixture.h

@@ -58,7 +58,7 @@ namespace box2d
 	int w_Fixture_getGroupIndex(lua_State * L);
 	int w_Fixture_setGroupIndex(lua_State * L);
 	int w_Fixture_destroy(lua_State * L);
-	int luaopen_fixture(lua_State * L);
+	extern "C" int luaopen_fixture(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_FrictionJoint.cpp

@@ -76,7 +76,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_frictionjoint(lua_State * L)
+	extern "C" int luaopen_frictionjoint(lua_State * L)
 	{
 		return luax_register_type(L, "FrictionJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_FrictionJoint.h

@@ -37,7 +37,7 @@ namespace box2d
 	int w_FrictionJoint_getMaxForce(lua_State * L);
 	int w_FrictionJoint_setMaxTorque(lua_State * L);
 	int w_FrictionJoint_getMaxTorque(lua_State * L);
-	int luaopen_frictionjoint(lua_State * L);
+	extern "C" int luaopen_frictionjoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_GearJoint.cpp

@@ -59,7 +59,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_gearjoint(lua_State * L)
+	extern "C" int luaopen_gearjoint(lua_State * L)
 	{
 		return luax_register_type(L, "GearJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_GearJoint.h

@@ -35,7 +35,7 @@ namespace box2d
 	GearJoint * luax_checkgearjoint(lua_State * L, int idx);
 	int w_GearJoint_setRatio(lua_State * L);
 	int w_GearJoint_getRatio(lua_State * L);
-	int luaopen_gearjoint(lua_State * L);
+	extern "C" int luaopen_gearjoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_Joint.cpp

@@ -92,7 +92,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_joint(lua_State * L)
+	extern "C" int luaopen_joint(lua_State * L)
 	{
 		return luax_register_type(L, "Joint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_Joint.h

@@ -38,7 +38,7 @@ namespace box2d
 	int w_Joint_getReactionTorque(lua_State * L);
 	int w_Joint_getCollideConnected(lua_State * L);
 	int w_Joint_destroy(lua_State * L);
-	int luaopen_joint(lua_State * L);
+	extern "C" int luaopen_joint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_MouseJoint.cpp

@@ -111,7 +111,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_mousejoint(lua_State * L)
+	extern "C" int luaopen_mousejoint(lua_State * L)
 	{
 		return luax_register_type(L, "MouseJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_MouseJoint.h

@@ -41,7 +41,7 @@ namespace box2d
 	int w_MouseJoint_getFrequency(lua_State * L);
 	int w_MouseJoint_setDampingRatio(lua_State * L);
 	int w_MouseJoint_getDampingRatio(lua_State * L);
-	int luaopen_mousejoint(lua_State * L);
+	extern "C" int luaopen_mousejoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_Physics.cpp

@@ -421,7 +421,7 @@ namespace box2d
 		0
 	};
 
-	int luaopen_love_physics(lua_State * L)
+	extern "C" int luaopen_love_physics(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/physics/box2d/wrap_PolygonShape.cpp

@@ -52,7 +52,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_polygonshape(lua_State * L)
+	extern "C" int luaopen_polygonshape(lua_State * L)
 	{
 		return luax_register_type(L, "PolygonShape", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_PolygonShape.h

@@ -34,7 +34,7 @@ namespace box2d
 {
 	PolygonShape * luax_checkpolygonshape(lua_State * L, int idx);
 	int w_PolygonShape_getPoints(lua_State * L);
-	int luaopen_polygonshape(lua_State * L);
+	extern "C" int luaopen_polygonshape(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_PrismaticJoint.cpp

@@ -187,7 +187,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_prismaticjoint(lua_State * L)
+	extern "C" int luaopen_prismaticjoint(lua_State * L)
 	{
 		return luax_register_type(L, "PrismaticJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_PrismaticJoint.h

@@ -50,7 +50,7 @@ namespace box2d
 	int w_PrismaticJoint_getLowerLimit(lua_State * L);
 	int w_PrismaticJoint_getUpperLimit(lua_State * L);
 	int w_PrismaticJoint_getLimits(lua_State * L);
-	int luaopen_prismaticjoint(lua_State * L);
+	extern "C" int luaopen_prismaticjoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_PulleyJoint.cpp

@@ -74,7 +74,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_pulleyjoint(lua_State * L)
+	extern "C" int luaopen_pulleyjoint(lua_State * L)
 	{
 		return luax_register_type(L, "PulleyJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_PulleyJoint.h

@@ -37,7 +37,7 @@ namespace box2d
 	int w_PulleyJoint_getLengthA(lua_State * L);
 	int w_PulleyJoint_getLengthB(lua_State * L);
 	int w_PulleyJoint_getRatio(lua_State * L);
-	int luaopen_pulleyjoint(lua_State * L);
+	extern "C" int luaopen_pulleyjoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_RevoluteJoint.cpp

@@ -187,7 +187,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_revolutejoint(lua_State * L)
+	extern "C" int luaopen_revolutejoint(lua_State * L)
 	{
 		return luax_register_type(L, "RevoluteJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_RevoluteJoint.h

@@ -50,7 +50,7 @@ namespace box2d
 	int w_RevoluteJoint_getLowerLimit(lua_State * L);
 	int w_RevoluteJoint_getUpperLimit(lua_State * L);
 	int w_RevoluteJoint_getLimits(lua_State * L);
-	int luaopen_revolutejoint(lua_State * L);
+	extern "C" int luaopen_revolutejoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_RopeJoint.cpp

@@ -50,7 +50,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_ropejoint(lua_State * L)
+	extern "C" int luaopen_ropejoint(lua_State * L)
 	{
 		return luax_register_type(L, "RopeJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_RopeJoint.h

@@ -34,7 +34,7 @@ namespace box2d
 {
 	RopeJoint * luax_checkropejoint(lua_State * L, int idx);
 	int w_RopeJoint_getMaxLength(lua_State * L);
-	int luaopen_ropejoint(lua_State * L);
+	extern "C" int luaopen_ropejoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_Shape.cpp

@@ -113,7 +113,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_shape(lua_State * L)
+	extern "C" int luaopen_shape(lua_State * L)
 	{
 		return luax_register_type(L, "Shape", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_Shape.h

@@ -42,7 +42,7 @@ namespace box2d
 	int w_Shape_computeMass(lua_State * L);
 
 	int w_Shape_destroy(lua_State * L);
-	int luaopen_shape(lua_State * L);
+	extern "C" int luaopen_shape(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_WeldJoint.cpp

@@ -76,7 +76,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_weldjoint(lua_State * L)
+	extern "C" int luaopen_weldjoint(lua_State * L)
 	{
 		return luax_register_type(L, "WeldJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_WeldJoint.h

@@ -39,7 +39,7 @@ namespace box2d
 	int w_WeldJoint_setDampingRatio(lua_State * L);
 	int w_WeldJoint_getDampingRatio(lua_State * L);
 
-	int luaopen_weldjoint(lua_State * L);
+	extern "C" int luaopen_weldjoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_WheelJoint.cpp

@@ -152,7 +152,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_wheeljoint(lua_State * L)
+	extern "C" int luaopen_wheeljoint(lua_State * L)
 	{
 		return luax_register_type(L, "WheelJoint", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_WheelJoint.h

@@ -46,7 +46,7 @@ namespace box2d
 	int w_WheelJoint_getSpringFrequencyHz(lua_State * L);
 	int w_WheelJoint_setSpringDampingRatio(lua_State * L);
 	int w_WheelJoint_getSpringDampingRatio(lua_State * L);
-	int luaopen_wheeljoint(lua_State * L);
+	extern "C" int luaopen_wheeljoint(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/physics/box2d/wrap_World.cpp

@@ -184,7 +184,7 @@ namespace box2d
 		{ 0, 0 }
 	};
 
-	int luaopen_world(lua_State * L)
+	extern "C" int luaopen_world(lua_State * L)
 	{
 		return luax_register_type(L, "World", functions);
 	}

+ 1 - 1
src/modules/physics/box2d/wrap_World.h

@@ -50,7 +50,7 @@ namespace box2d
 	int w_World_getContactList(lua_State * L);
 	int w_World_queryBoundingBox(lua_State * L);
 	int w_World_rayCast(lua_State * L);
-	int luaopen_world(lua_State * L);
+	extern "C" int luaopen_world(lua_State * L);
 
 } // box2d
 } // physics

+ 1 - 1
src/modules/sound/wrap_Decoder.cpp

@@ -57,7 +57,7 @@ namespace sound
 		{ 0, 0 }
 	};
 
-	int luaopen_decoder(lua_State * L)
+	extern "C" int luaopen_decoder(lua_State * L)
 	{
 		return luax_register_type(L, "Decoder", functions);
 	}

+ 1 - 1
src/modules/sound/wrap_Decoder.h

@@ -33,7 +33,7 @@ namespace sound
 	int w_Decoder_getChannels(lua_State * L);
 	int w_Decoder_getBits(lua_State * L);
 	int w_Decoder_getSampleRate(lua_State * L);
-	int luaopen_decoder(lua_State * L);
+	extern "C" int luaopen_decoder(lua_State * L);
 
 } // sound
 } // love

+ 1 - 1
src/modules/sound/wrap_Sound.cpp

@@ -113,7 +113,7 @@ namespace sound
 		0
 	};
 
-	int luaopen_love_sound(lua_State * L)
+	extern "C" int luaopen_love_sound(lua_State * L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/sound/wrap_SoundData.cpp

@@ -83,7 +83,7 @@ namespace sound
 		{ 0, 0 }
 	};
 
-	int luaopen_sounddata(lua_State * L)
+	extern "C" int luaopen_sounddata(lua_State * L)
 	{
 		return luax_register_type(L, "SoundData", functions);
 	}

+ 1 - 1
src/modules/sound/wrap_SoundData.h

@@ -37,7 +37,7 @@ namespace sound
 	int w_getSampleRate(lua_State * L);
 	int w_setSample(lua_State * L);
 	int w_getSample(lua_State * L);
-	int luaopen_sounddata(lua_State * L);
+	extern "C" int luaopen_sounddata(lua_State * L);
 
 } // sound
 } // love

+ 2 - 2
src/modules/thread/wrap_Thread.cpp

@@ -155,7 +155,7 @@ namespace thread
 		{ 0, 0 }
 	};
 
-	int luaopen_thread(lua_State *L)
+	extern "C" int luaopen_thread(lua_State *L)
 	{
 		return luax_register_type(L, "Thread", type_functions);
 	}
@@ -249,7 +249,7 @@ namespace thread
 		0
 	};
 
-	int luaopen_love_thread(lua_State *L)
+	extern "C" int luaopen_love_thread(lua_State *L)
 	{
 		if (instance == 0)
 		{

+ 1 - 1
src/modules/thread/wrap_Thread.h

@@ -39,7 +39,7 @@ namespace thread
 	int w_Thread_peek(lua_State *L);
 	int w_Thread_set(lua_State *L);
 
-	int luaopen_thread(lua_State *L);
+	extern "C" int luaopen_thread(lua_State *L);
 
 	int w_newThread(lua_State *L);
 	int w_getThreads(lua_State *L);

+ 1 - 1
src/modules/timer/wrap_Timer.cpp

@@ -79,7 +79,7 @@ namespace timer
 	};
 
 
-	int luaopen_love_timer(lua_State * L)
+	extern "C" int luaopen_love_timer(lua_State * L)
 	{
 		if (instance == 0)
 		{