Topics Building 3rd Party C Modules

A plethora of 3rd party packages are available for use in Lua, most of which can be found at LuaForge.  These can either be made up of pure Lua code, compiled as a DLL (C Module), or a mixture of both.  The Lua code can be used out of the box with XLua, but C Modules that have been precompiled into a DLL are not directly compatible.  Instead, they must be recompiled to use the XLua extension (xlua.mfx) in place of lua51.dll.

If you already have some prior experience with building C or C++ projects, then the basic requirements are as follows.

XLua uses the same Lua header files as the official Lua distribution, so if you've downloaded the source code for a C Module, and you're following its own build instructions, then the only change you need to make is to reference XLua's .lib file instead of Lua's .lib file.

Each project is different, so it would be impossible to cover all the possible changes you would need to make to the build process to produce an XLua-compatible DLL.  A couple of examples using real projects are provided to make things clearer.

Once you've built and tested a C Module with XLua and everything works, remember to share!  Visit the Clickteam Lua Scripting forum and share your compiled DLL so everyone else can benefit.

Copyright 2010 Justin Aquadro