My favorites | Sign in
Project Logo
                
Search
for
Updated Sep 17, 2008 by danielbaggio
Swig  
this page deals with details on how to call C++ functions from Python using SWIG. This documentation is under development

Python bindings have been successfully implemented check [InstallingOnLinux] for more information

Python bindings work through shared objects that are compiled with help from SWIG. These libraries implement some init function. They are named with the _ prefix. This way, ehci library is imported from some _ehci.so dynamic library.

According to python install instructions the _ehci.so files should go to some directory like /usr/local/lib/python2.5/site-packages or to the same directory in which the user is.

In order to make the right coupling between the library and python, the interface file, ehci.i should be properly modified.

Compiling dynamic library on Linux

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
swig -c++ -python ehci.i
g++ -c ehci_wrap.c ehci.cpp -I /usr/include/python2.5/ `pkg-config opencv --cflags
g++ -shared ehci.o ehci_wrap.o -L /usr/local/lib/ -lGL -lglut -lcv -lhighgui -lcvaux  -lml -lcxcore -o _ehci.so
python
import ehci

Links

Swig tutorial

Swig Autoconf

Using typemaps


Sign in to add a comment
Hosted by Google Code