Delphi extension

Christopher T King squirrel at WPI.EDU
Thu Jun 24 16:52:37 CEST 2004


> I was given a  libxx.so  that was probably written in Delphi.
> I need to wrap it so that I can call the functions/procedures
> of the library from Python.  I tried the usual extension
> technique compiling a C file.  I don't get anything meaningful
> back when I call, so it doesn't work, or I am missing some
> critical point.  I have spent a good deal of time searching

I don't know anything about Delphi; it may use a different calling 
convention than C (unlikely). If that's the case, however, you're out of 
luck unless you can find a Delphi-C or Delphi-Python interface module.

Assuming it uses the C calling convention, you can possibly use the dl 
module:

 import dl
 c=dl.open('/path/to/my/lib.so')
 c.call('myfunc',arg1,arg2)

dl is unfortunately limited to passing integers, strings, and NULL, and to 
returning integers, so it's likely not to be useful for complex data 
structures.




More information about the Python-list mailing list