Begginer in python trying to load a .dll

Chris Kaynor ckaynor at zindagigames.com
Tue Aug 12 14:55:14 EDT 2014


On Tue, Aug 12, 2014 at 11:48 AM, Skip Montanaro <skip at pobox.com> wrote:

> Just as the off-chance your DLL was written in C++... I don't think
> you can interface with ctypes directly. I think you would have to
> write a little shim DLL which exposes a C-compatible API.
>

You should be able to use ctypes with a C++ library, you'd just need to
know how your C++ compiler handles name mangling. Typically, changes are
made to accommodate classes, namespaces, and function overloads. Of course,
if you were to change to a different compiler (possibly including a
different version) or made minor tweaks to the functions, you'd have to
update all the Python code to use the new name mangling scheme.

Hmm...On second thought, maybe just only using functions exports with
"extern C" would be easier - or just using a C compiler.

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140812/d13be7f2/attachment.html>


More information about the Python-list mailing list