Stuck building a Python extension
David Hughes
dfh at forestfield.co.uk
Thu Sep 25 09:07:00 EDT 2003
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);
which I'm calling from:
static PyObject *oneway_SharewareLimit(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char * company;
char * software;
short evalperiod;
short expired;
if (!PyArg_ParseTuple(args,"ssh:SharewareLimit",&company ,&software,
&evalperiod))
return NULL;
expired = SharewareLimit(company ,software, evalperiod);
return Py_BuildValue("h",expired);
}
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.
Thanks, David.
More information about the Python-list
mailing list