lua-users home
lua-l archive

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



> I find the define SWIG_init luaopen_foo, but when I link I got an error
> about undefined reference.

Are you, perchance, calling it from a C++ file? Then you need to
declare it as extern "C", something like:


extern "C" int luaopen_foo (lua_State *);

...

void
setup_lua ()
{
lua_State *L = lua_open();

luaL_openlibs (L); // load standard libraries

luaopen_foo (L); // load the wrapped module

...
}


-Miles
--
The key to happiness
is having dreams. [from a fortune cookie]

Hello there,
All this looks correct (assuming that you want to be static linked).
You should be linking foo.c wrap_foo.c, your interpreter file and the lua library/dll.
Tell us what the linker error says, and we can tell you what you are missing.
If the error mentioned lua_* then is probably lua.lib, if its
luaopen_foo, then you forgot the wrap_foo.c, otherwise its probably the foo.c file.

Regards,
Mark



Support the World Aids Awareness campaign this month with Yahoo! for Good