lua-users home
lua-l archive

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

"Roger D. Vargas" <> writes:
> Then, whats the correct way to use that function? When I search the file
> 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 *);


   setup_lua ()
     lua_State *L = lua_open();

     luaL_openlibs (L);		// load standard libraries

     luaopen_foo (L);		// load the wrapped module


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