python and shared libaray

David LeBlanc whisper at oz.net
Mon Jun 10 23:29:14 EDT 2002


Yes, you could use that in Python, but it's not a matter of just importing
the .so library. In order to use it, you'll have to create a wrapper .lib or
.so that converts between python objects and C/C++ procedure calls and data
types.

The doc that comes with Python includes information on creating Python
extensions and a couple of other good places to start are:

www.boost.org if it's C++
www.swig.org if it's C

The missing init function is one of the things you'll have to add. In there
is where you would import the C/C++ .so lib - or it gets auto-included as a
consequence of your having linked against it.

Regards,

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Steven Pokrandt
> Sent: Monday, June 10, 2002 19:21
> To: python-list at python.org
> Subject: python and shared libaray
>
>
> I have a vendor supplied .so file, header file and docs.  I would like
> to use this
> .so file in python but don't have the src.  Is it possible to link
> this library ie:
>
> import filename.so
>
> when I try the python complains about no init function..  can I add
> this to the .so  without having the src?
>
> can someone point me to a howto?
>
> please send message to the following address..  spokra (AT) attbi
> (dot) com
>
> you get the meaning of the email address, and hopefully the spammers
> don't
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list