[gdal-dev] Help needed regarding SWIG Packaging

Vipul Raheja vipul.iiith at gmail.com
Mon Jul 25 15:11:31 EDT 2011


Hi Even,

Thanks for the reply.

I was trying out the way you suggested it. I created a master.i which
%includes all the other .i files. Upon compilation I am facing anther issue.
It is a trivial issue I guess but I am not able to figure out. The things
is, compilation with swig is usually in following 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 Mon, Jul 25, 2011 at 11:19 PM, Even Rouault <even.rouault at mines-paris.org
> wrote:

> Le lundi 25 juillet 2011 11:27:41, Vipul Raheja a écrit :
> > Hi,
> >
> > I am working on developing SWIG-Python wrappings for OSSIM, a tool for
> > satellite image processing. I wanted some help regarding the same since
> > GDAL uses Swig for the same. I am facing a problem regarding the
> > packaging.
> >
> > As of now I have developed SWIG-Wrapper interface files (.i Files) for
> 130
> > different classes, and am ale to access them independently from a Python
> > console also; but I am not able to combine them into a single module so
> as
> > to be able to access them all together from a single import command, i.e.
> > suppose there are classes a.cpp/a.h and b.cpp/b.h, then I have created
> > their swig wrappers a.i and b.i, but in order to access them from a
> Python
> > console, I have to compile them separately, generate the .so file and
> when
> > I do an 'import module' in Python, I can access only one class's
> > functionality at a time (the one which I compiled). In order to access
> the
> > other class's functionality, I have to compile that class, generate the
> > .so file, and then I am able to import it.
> >
> > And what I want is that by doing a single compilation, .so generation and
> > import command, I should be able to access all the wrapped functions from
> > Python rather than the piece wise way which is happening currently.
> >
> > Any ideas on the issue? Help will be greatly appreciated.
>
> I'm far from being the ultimate swig specialist, but I think that you could
> create a global .i that would %include each of the .i . Then you just run
> swig
> over that global .i
>
> >
> > Thanks and Regards,
> > Vipul Raheja
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110726/650245a4/attachment.html


More information about the gdal-dev mailing list