Newbie: C Extensions: dynamic module does not define init function
Gerhard Häring
gh_pythonlist at gmx.de
Tue Jan 8 00:11:17 EST 2002
Le 08/01/02 ? 10:21, Karthik Gurumurthy écrivit:
> 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
>
> void
> initelemlist(void)
> { [...]
That's wrong. Should be:
DL_EXPORT(void)
inititemlist(void)
DL_EXPORT is a Python macro that will do the symbol exporting trick on any
platform you might wish to compile your project.
Btw. I recommend you follow Alex's advice to use distutils. It really makes
your job much simpler. I always found it confusing which runtime libraries to
link against in MSVC, how to import/export symbols, etc.
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list