problem compiling extension on Win32

Fredrik Lundh fredrik at pythonware.com
Thu Aug 26 06:27:58 EDT 1999


<g_v_wilson at my-deja.com> wrote:
> I am trying to build a small Python extension
> in C on Windows NT using the Microsoft 'cl'
> compiler from the command line (long story).
> Everything is working, except my attempts to
> #define USE_DL_EXPORT and then use DL_EXPORT.
> I have tried #defining the former both before
> and after #including Python.h, but DL_EXPORT's
> expansion is never correct.

iirc, the DL_EXPORT stuff is there to make sure
everything is exported from the python core dll.

if you're building a dynamic extension, and have
trouble exporting the init function, you might do
something like this instead:

void
#ifdef WIN32
__declspec(dllexport)
#endif
initsgmlop()
{
    /* Patch object type */
    FastSGMLParser_Type.ob_type = &PyType_Type;

    Py_InitModule("sgmlop", _functions);
}

(make sure WIN32 is defined when you compile the
module).

also note that you may have to initialize your
type descriptors (if any) in the init function
under Windows; for more info, see:

    http://www.python.org/doc/FAQ.html#3.24

</F>





More information about the Python-list mailing list