Newbie: C Extensions: dynamic module does not define init function

Jason Orendorff jason at jorendorff.com
Mon Jan 7 23:47:16 EST 2002


> thanks!
> 
> i used vc++ and compiled for release and got the elemlist.dll
> i copied the resulting dll to a folder and imported it and i got the
> following error.
> 
> >>> import elemlist
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: dynamic module does not define init function (initelemlist)
> >>>
> 
> 
> But , elemlist.c has the method initelemlist [...]

It has it, but it isn't exported.  Windows DLLs can contain many
functions; some are exported (and can be called from outside),
some not.

If you use "python setup.py build", then the init function will
be properly exported.  setup.py runs the linker with the
/EXPORT:inititemlist flag.

If you still refuse to use setup.py, there's probably a
Project > Settings > Linker setting that you can tweak; good luck.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list