Stuck building a Python extension

Daniel Dittmar daniel.dittmar at sap.com
Thu Sep 25 11:23:09 EDT 2003


David Hughes wrote:
> I'm nearly there building a Python extension module to access a set of
> functions in a .dll, but I'm getting an unresolved external error for
> one of the function calls (using MS Visual C++ V6).
>
> The function prototype is:
>
> extern short __stdcall SharewareLimit(char * s1, char * s2, short i);
[..]
> I would expect the code to be calling a function called
> _SharewareLimit at 10 to match the size of the arguments (and which I
> have called successfully from a Fortran program in the past), but the
> unresolved external is _SharewareLimit at 12, implying that somewhere
> the short 2-byte integer is being promoted to 4 bytes.
>
> I know this is probably a C compiler (settings?) not a Python
> problem, but I'd appreciate some assistance as my knowledge in this
> area is sketchy.

C compilers are generally promoting shorts to ints and floats to doubles
when passing them as arguments. This is reflected in the @12.

#pragma pack (2) didn't work either, so I'm out of ideas. Do you know which
language created the DLL?

Daniel

>
> Thanks, David.






More information about the Python-list mailing list