Wrapping C with Python
tjreedy at udel.edu
Tue Aug 5 03:51:17 CEST 2008
> RPM1 wrote:
>> Basically you just compile your C code as a regular C code dll.
>> ctypes then allows you to access the functions in the dll very easily.
> Does that work with C++ code too or just C?
On Windows, You can apparently works either with stdcall or cdecl functions.
"ctypes tries to protect you from calling functions with the wrong
number of arguments or the wrong calling convention. Unfortunately this
only works on Windows. It does this by examining the stack after the
function returns, so although an error is raised the function has been
called:" "To find out the correct calling convention you have to look
into the C header file or the documentation for the function you want to
call." I do not know if these are only C-isms or also C++-isms.
More information about the Python-list