ctypes: How to call unexported functions in a dll

Coert Klaver (DT) coert at holmes.nl
Tue Jan 5 12:19:00 CET 2010


Hi,

I am using ctypes in python 3 on a WXP machine

Loading a dll and using its exported functions works fine.

Now I want to use a function in the dll that is not exported.

In C this can be done by just casting the address in the dll of that
function to an apropriate function pointer and call it (you need to be
sure about the address). Can a similar thing be done directly with
ctypes?

A work around I see is writing in wrapper dll in c that loads the main
dll, exports a function that calls the unexported function in the main
dll, but I don't find that an elegant solution.

Thanks for any hint in the right direction.

BR

Coert



More information about the Python-list mailing list