Simple question...

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Simple question...

Bill Lanier
I have a vendor supplied shared object file (an api) say, "vendor.o", written
in C++. I want to wrap this object file with perl using swig. How do I do it?
I've never used swig before, but have gone thru the online tutorial. Do I
need to place all the functions in the .i file that are contained in the .o
file? Where should the .o file reside?

Thanks,
Swig nube



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Steve Juranich-2
On 11/2/05, Bill Lanier <[hidden email]> wrote:
> I've never used swig before, but have gone thru the online tutorial. Do I
> need to place all the functions in the .i file that are contained in the .o
> file?

Only the ones you want hooks for.

> Where should the .o file reside?

I'm not familiar enough with how Perl works to answer this, but I
assume that Perl has some kind of $PATH that is searched for
appropriate files.  You'll also need to make sure that LD_LIBRARY_PATH
contains the diriectory that has the vendor .so file in it.  That is,
assuming you're in a UNIX type environment (that's my assumption given
the file names you use).

Lots of luck.
--
Steve Juranich
Tucson, AZ
USA


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Bill Lanier
Thanks, Steve.

On Wednesday 02 November 2005 02:26 pm, Steve Juranich wrote

> On 11/2/05, Bill Lanier <[hidden email]> wrote:
> > I've never used swig before, but have gone thru the online tutorial. Do I
> > need to place all the functions in the .i file that are contained in the
> > .o file?
>
> Only the ones you want hooks for.
>
> > Where should the .o file reside?
>
> I'm not familiar enough with how Perl works to answer this, but I
> assume that Perl has some kind of $PATH that is searched for
> appropriate files.  You'll also need to make sure that LD_LIBRARY_PATH
> contains the diriectory that has the vendor .so file in it.  That is,
> assuming you're in a UNIX type environment (that's my assumption given
> the file names you use).
>
> Lots of luck.
> --
> Steve Juranich
> Tucson, AZ
> USA
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Swig-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swig-user


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Simple question...

Kevin Ruland
In reply to this post by Steve Juranich-2

Bill,

If you have a vendor.o file it's probably not a shared object but rather
just pic object code.  This means you need to link vendor.o directly
into the perl module shared object.

I've used perl's ExtUtils::MakeMaker pretty successfully.

Something like this should be sufficient:

use ExtUtils::MakeMaker;

WriteMakefile( NAME => 'vendor',   # This is the name of the perl module
you will use
LD => "g++", # since it's a c++ library
LIBS => "", # This is where you'd put any -lXXX to link the perl shared
object library.
INC => "-IXXX", # where you put the vendor.h file or other things needed
to compile
OBJECT => 'vendor_wrap.o vendor.o' # vendor_wrap.o will be created from
vendor_wrap.cpp the swig wrapper source code.
);

If you chose to name the Perl module something other than vendor (using
%module "", or the -module command line argument) then you need to
change the string "vendor" in a few places (but not all).  It needs to
be changed in the NAME entry, and in the "vendor_wrap.o" of the OBJECT
entry.

After running perl Makefile.PL, make install, the perl module (and the
compiled swig wrapper shared object) will be installed in the proper
location on your system.

Kevin

Steve Juranich wrote:

>On 11/2/05, Bill Lanier <[hidden email]> wrote:
>  
>
>>I've never used swig before, but have gone thru the online tutorial. Do I
>>need to place all the functions in the .i file that are contained in the .o
>>file?
>>    
>>
>
>Only the ones you want hooks for.
>
>  
>
>>Where should the .o file reside?
>>    
>>
>
>I'm not familiar enough with how Perl works to answer this, but I
>assume that Perl has some kind of $PATH that is searched for
>appropriate files.  You'll also need to make sure that LD_LIBRARY_PATH
>contains the diriectory that has the vendor .so file in it.  That is,
>assuming you're in a UNIX type environment (that's my assumption given
>the file names you use).
>
>Lots of luck.
>--
>Steve Juranich
>Tucson, AZ
>USA
>
>
>-------------------------------------------------------
>SF.Net email is sponsored by:
>Tame your development challenges with Apache's Geronimo App Server. Download
>it for free - -and be entered to win a 42" plasma tv or your very own
>Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
>_______________________________________________
>Swig-user mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/swig-user
>  
>


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user