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

Jason Orendorff jason at
Tue Jan 8 05:47:16 CET 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 build", then the init function will
be properly exported. runs the linker with the
/EXPORT:inititemlist flag.

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

## Jason Orendorff

More information about the Python-list mailing list