From: codeoedoc <cod...@gm...> - 2013-02-22 18:14:08
|
Thanks a lot for the help Nadig! Xin On Thu, Feb 21, 2013 at 2:50 PM, Nadig Nikil <ni...@qr...> wrote: > Hi Xin, > > PIC will depend on the machine. If you are generating 32bit code and linking onto a 32bit machine, then you don't need PIC necessarily. > Most people need PIC when you are building 32bit code on 64bit machines, since the addresses might not be within 32 bit space for your shared libraries. There is nothing contingent on C++ for PIC working / not working, it is more a matter of your architecture and situation. > > As far as I know, python will require you to use some manner of dynamic library, typically _XXX.so in naming where XXX is the module name. > > -----Original Message----- > From: xin...@gm... [mailto:xin...@gm...] On Behalf Of codeoedoc > Sent: Thursday, February 21, 2013 4:36 PM > To: Nadig Nikil > Cc: swi...@li... > Subject: Re: [Swig-user] swig with static c++ lib > > Thanks Nadig. To answer the question that I posted, I just got the following works: > > 1. Shared SWIG lib using external shared lib. > 2. Shared SWIG lib using external static lib. > > Both works fine. Also, for the static lib, I didn't use PIC during linkage. It still works, while according some other posts, it shouldn't work for c++... > > For python, it's best to use dynamic external lib because python can do runtime lib loading. In order for python to use static external lib, the external lib needs to be linked with python binary, which is not that straightforward. > > Regards, > Xin > > On Wed, Feb 20, 2013 at 10:13 PM, Nadig Nikil <ni...@qr...> wrote: >> SWIG does not do anything with linkage, purely with file generation. >> You can specify static or dynamic linkage at build / compile time >> through your compiler flags >> >> -----Original Message----- >> From: codeoedoc [mailto:cod...@gm...] >> Sent: Thursday, February 21, 2013 12:18 PM >> To: swi...@li... >> Subject: [Swig-user] swig with static c++ lib >> >> Hi there, >> >> I'm working on a project that needs wrapping static c++ lib and expose python API. I did some search and still not clear on, whether I can use static c++ lib with SWIG, and whether Python can load static library. It seems to use static library in python, one has to wrap the static lib into dynamic lib. >> >> Thanks advance for help! >> Xin >> >> ---------------------------------------------------------------------- >> -------- Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: >> http://p.sf.net/sfu/appdyn_d2d_feb >> _______________________________________________ >> Swig-user mailing list >> Swi...@li... >> https://lists.sourceforge.net/lists/listinfo/swig-user |