[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem with swig
 
- From: Miles Bader <miles@...>
 
- Date: Fri, 15 Feb 2008 08:22:03 +0900
 
"Roger D. Vargas" <luo_hei@yahoo.es> writes:
> Because the SWIG docs say so. The C++ wrapper code generated by SWIG
> should have such function, and also have found that it can be named
> luaopen_ClassA(). But none of both works.
For my file "foo.i", swig generates "luaopen_foo".  I think swig gets
the name "foo" from the %module commnad in the .i file; do you have a
line like "%module ClassA" in your .i file?
Anyway, since swig generate C code, you can easily look at it and see
what it's doing.  In my version of swig, it outputs some lines like:
   #define SWIG_name      "foo"
   #define SWIG_init      luaopen_foo
   #define SWIG_init_user luaopen_foo_user
... and then later in that file defines:
   #ifdef __cplusplus
   extern "C" {
   #endif
   SWIGEXPORT int SWIG_init(lua_State* L)
   {
      ...
   }
with the reuslt of defining an exported function called "luaopen_foo".
-Miles
-- 
We live, as we dream -- alone....