Hi, 

I was trying out the way David suggested it. It is a trivial issue I guess but I am not able to figure out. The things is, compilation with swig is usually in 3 steps -

$ swig -c++ -python -Wall -I/<path to header files to be included> master.i
This I am able to do fine, it generates "master_wrap.cxx" and "module.py" files

$ g++ -c - fPIC [path to file to be linked] master_wrap.cxx -I/<path to python library>
Now since there are multiple files that need to be linked, I am not able to figure out what to write here in place of [path to file to be linked]. It is supposed to be the address of source file to be linked but in this case, there are multiple files spread in multiple folders that need to be linked.

Upon giving the address of the parent folder, it says, "linker input file unused because linking not done", clearly since it wants a filename and not a folder address.

Kindly Help.

Regards,
Vipul Raheja

 
On Sat, Jul 16, 2011 at 4:24 AM, David Nadlinger <code@klickverbot.at> wrote:
Hi Vipul,

what about simply creating a »master« .i file which just %includes all the other separate files. This way, you can have a single SWIG module (and thus also a single dynamic library), but still keep the different parts nicely separated.

Other than that, it depends on how the language module handles library loading. I don't know the specifics of the Python module, but e.g. for C# and D, you can specify the name of the dynamic library file the generated code will try to load. This way, you can just specify the same -dllimport/-wrapperlibrary parameter on each SWIG invocation for all the .i files, and then compile all the generated C++ code into a single dll/so/dylib.

Hope this helps,
David


On 7/16/11 12:00 AM, Vipul Raheja wrote:
Hi Sam,

Firstly, thanks for your reply.

However, in our case, we are looking at around 130 classes, and
moreover, there is a pressing need to keep them in their divided and
modular form for code understand-ability and maintainability. Aren't
their any other alternatives?

Regards,
Vipul

On Sat, Jul 16, 2011 at 1:29 AM, Sam Hendley
<shendley@greenenergycorp.com <mailto:shendley@greenenergycorp.com>> wrote:

   I think the easiest way to do this is merge all of the ".i" files
   together into a single file. Usually there is only one .i file per
   system, we wrapped a protocol library with around 20 classes with
   one file.

   Sam

   On Fri, Jul 15, 2011 at 1:48 PM, Vipul Raheja <vipul.iiith@gmail.com
   <mailto:vipul.iiith@gmail.com>> wrote:

       Hi,

       I have been working on Swig-Python wrapping of OSSIM, a great
       tool for image processing and analysis. After creating
       respective wrappers (.i files) for different classes, I was able
       to create (for each respective .i file), a (.so) library and
       access the functionality of the earlier C++ libraries in Python.
       But one .i wrapper file and one C++ source file compile into one
       .so library.

       So now I've got many .so libraries that I'd like to combine into
       one shared library so that it doesn't depend on the original .so
       files anymore. Say I have a.so and b.so. Can I produce c.so as a
       single shared library with all the functions exported by a and
       b, of course resolving all intra-dependencies (i.e. all
       functions of b.so called by a.so and the other way around)?

       Help greatly appreciated.

       Regards,
       Vipul Raheja

       ------------------------------------------------------------------------------
       AppSumo Presents a FREE Video for the SourceForge Community by Eric
       Ries, the creator of the Lean Startup Methodology on "Lean Startup
       Secrets Revealed." This video shows you how to validate your ideas,
       optimize your ideas and identify your business strategy.
       http://p.sf.net/sfu/appsumosfdev2dev
       _______________________________________________
       Swig-user mailing list
       Swig-user@lists.sourceforge.net
       <mailto:Swig-user@lists.sourceforge.net>

       https://lists.sourceforge.net/lists/listinfo/swig-user





------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev



_______________________________________________
Swig-user mailing list
Swig-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user