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

Alex Martelli aleax at aleax.it
Tue Jan 8 03:52:19 EST 2002


"Karthik Gurumurthy" <karthikg at aztec.soft.net> writes:
    ...
> i used vc++ and compiled for release and got the elemlist.dll
    ...
> ImportError: dynamic module does not define init function (initelemlist)
    ...
> But , elemlist.c has the method initelemlist
> 
> void
> initelemlist(void)

...but it doesn't export it from the DLL (by linking with a .DEF
file, or marking it as __declspec__(dllexport), or using suitable
linker commandline switches, ...).  You can check that with the
Microsoft utility DUMPBIN.EXE, typically installed somewhere as
part of any VC++ installation; use the /EXPORTS switch to it.


Once again, with feeling (requoting from my previous post):

> Easiest way to build extensions on any platform is with the
> distutils, as exemplified at:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66509

The distutils handle this and many other details for you.  Why
reinvent the wheel... and have it come out square?-)


If you're keen on using a VStudio build rather than distutils,
at the very least build with distutils first, take note of all
the switches distutils are using for compiling and linking, and
adjust your VStudio .DSP configuration to ensure that the same
switches are used.  It's probably more hassle than it's worth
undergoing, but it still beats trying to get the VStudio config
right by pure trial and error, IMHO.


Alex






More information about the Python-list mailing list