importing dlls with python
Martin v. Loewis
martin at v.loewis.de
Wed Feb 20 02:15:45 EST 2002
tkeon0 at netscape.net (Trevor Keon) writes:
> Hi, I am new to Python, and was wondering if it was possible to import
> dlls written in Delphi 5? I have tried a number of methods to make it
> work, and I either get:
Depends on what you are trying to do. If you want to use the DLL
as-is, it will be tricky. If you can arrange for the DLL to look like
a Python module, it will interact much better.
> function initxxx: Integer; StdCall;
> export;
If you want to implement a Python module as a DLL, you need to follow
the Python/C API, see
http://www.python.org/doc/current/ext/ext.html
In particular, this means that you need to call InitModule4 inside
initxxx, and that initxxx needs to get a proper signature.
If you want to call an arbitrary DLL (be it compiled by Delphi or by
other means), you can try the CallDLL package. A 2.1 version of
calldll is available from
http://www.nightmare.com/software.html
Regards,
Martin
More information about the Python-list
mailing list