lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Wesley Smith wrote:
That's what I do in Visual Studio.  Make a dll project, edit out all
the kruft like resources and junky headers amonth other project
settings that MS puts in there for you.  Then, add the 3 main Lua
headers to your project as well as lua51.dll and you should be set.
And don't forget to add luaopen_lpeg to the .def file.

wes


Alternatively, you can use premake from http://premake.sourceforge.net/. With the premake.lua file listed below, run "premake --target vs2005", and use the lpeg.sln generated.

Rather than creating a .def file, I just put the following at the top of the lpeg.c file:

#ifdef _WIN32
__declspec(dllexport) int luaopen_lpeg (lua_State *L);
#endif


----- premake.lua -----
project.name = "lpeg"

package.name = "lpeg"
package.kind = "dll"
package.language = "c"
package.files = { "lpeg.c" }
if windows then
  package.includepaths = { "C:/lua/include" }
  package.libpaths = { "C:/lua" }
  package.linkoptions = { "/NODEFAULTLIB:LIBCMT" }
  package.links = { "lua5.1" }
elseif linux then
  package.includepaths = { "/usr/include" }
  package.libpaths = { "/usr/lib" }
  package.linkoptions = { }
  package.links = { "lua" }
end
package.objdir = "obj"
package.targetprefix = ""