Stuck building a Python extension

Alex Martelli aleax at aleax.it
Thu Sep 25 10:06:37 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.

Looks like somebody is doing something funky such as "#define short int".
Check it out with a printf of sizeof(short) [faking out the call that is
not working] -- if it's 4 then you're left to determine who dun it and
nuke THAT out somehow.


Alex






More information about the Python-list mailing list