lua-users home
lua-l archive

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


Hi Mark,

Thanks for the pointers.  I'm linking all the wrappers into the application directly rather than building as a seperate library.  Perhaps later in this project I'll build then as libs, but for the time being for simplicity I'd like to just build as a single app.

W.r.t Swig/Lua related questions which is the better venue for asking questions, the Swig or Lua or both? 

Thanks,
Robert.

On 5/15/06, mark gossage <mark@gossage.cjb.net> wrote:
Hello Robert,

I am the maintainer of the Lua part of SWIG. I will try to help you on this one.

Each SWIG .i file is for one library, and each one needs one %module.
The code will not allow more than one module in a single file.

As you figured out, you can have many .i files, one per module. Each one has its own namespace (so to speak).

For you to get the compiler error, I reckon you must be static linking. If you use dynamic linking (ie each to a DLL/SO) it doesn't happen.
The reason for this is that there are a few bits of common code found in each of the SWIG wrapper files. And they seem to be conflicting with each other.

A quick fix, would be something like either a global search-replace for each file.
Or if you add the following into the your .i file
%module lib1
%{
#define SWIG_init_user SWIG_init_user_lib1
%}

%module lib2
%{
#define SWIG_init_user SWIG_init_user_lib2
%}

This would remove the conflict by renaming the conflicting function. (You would have to have a different unique name for each module, its ugly, but at least it means you don't need to edit the generated file).

Let me go back an look at the code and I will give you some more advice later.

Regards,
Mark Gossage

PS. For swig related questions, you can also post to the SWIG mailing list