lua-users home
lua-l archive

Re: problem with swig

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


"Roger D. Vargas" <luo_hei@yahoo.es> 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 *);
 ...
 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]

AltStyle によって変換されたページ (->オリジナル) /