Lazy Swig User

POYEN OP Olivier (DCL) Olivier.POYEN at clf-dexia.com
Tue Mar 4 09:59:24 EST 2003


Hi all,

I'm experimenting Swig on python, to produce a wrapper around libxosd.
Using swig 1.3 (debian)
Using python 2.2

The point here is that I really want to do it the lazy way: I don't want to write anny interface code, and dig in .h file to find what to write. I know this may not be the best way, but I'm looking for a proof of concept.

So, I've this interface file:
#cat xosd.i
%module xosd
%{
#include "xosd.h"
%}
%include "xosd.h"

Generating _wrap file is OK. Compiliing xosd_wrap.c AND xosd.c is cool, as are .o and .so file. 
xosd.c and xosd.h can be found in the current directory.

When running python -c "import xosd", I get:
import _xosd
ImportError: ./_xosd.so : undefined Symbol: XFreePixmap

It seems I got an issue in including some X11 header file. The error was not reported by either gcc or swig. 
So, I perhaps have to wrap the X11 librairy , but I think it is a wrong solution.

As I said, I want to be lazy: I don't want to write a nice xosd.i interface file with just a few functions, which perhaps might work. I want to try the "%include .h file" option. 
By the way, if this can not work, does anyone know a way to lazyly interface to c/c++ ?

I know a little about pyrex, but it requires you to write down a .pyx file, the interface.
I know that python is made to be easily extended to C/C++, but I don't want to write the wrapping C call.
I knwo that... i'm asking for a lot ! 

And, BTW, I know that, if I really want to be lazy, I could use the already existing pyosd :)

But, I do that in order to learn extending python in C/C++. 

Any help would be...just great !

Thanks in advance,

OPQ
-------------- next part --------------
-----------------------------------------------------------------

Ce message est confidentiel ; son contenu ne represente en aucun

cas un engagement de la part de Dexia Credit Local ou de Dexia

CLF Banque. Toute publication, utilisation ou diffusion, meme

partielle, doit etre autorisee prealablement par l'emetteur. Si

vous n'etes pas destinataire de ce message, merci d'en avertir

immediatement l'expediteur.



This message is confidential ; its contents do not constitute a

commitment by Dexia Credit Local or Dexia CLF Banque. Any

unauthorised disclosure, use or dissemination, either whole or

partial, is prohibited. If you are not the intended recipient of

the message, please notify the sender immediately.

-----------------------------------------------------------------

Consultez notre site internet www.dexia-clf.fr

La cle d'une gestion optimisee du secteur public local

-----------------------------------------------------------------


More information about the Python-list mailing list