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

Karthik Gurumurthy karthikg at aztec.soft.net
Mon Jan 7 23:51:27 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

void
initelemlist(void)
{
    /* Create the module and add the functions */
    PyObject *m = Py_InitModule("elemlist", elemlist_methods);
    /* Finish initializing the type-objects */
    cons_type.ob_type = &PyType_Type;
}


thanks,
karthik.

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Alex Martelli
Sent: Monday, January 07, 2002 8:40 PM
To: python-list at python.org
Subject: Re: Newbie: problem with C extensions


"Karthik Gurumurthy" <karthikg at aztec.soft.net> wrote in message
news:mailman.1010412730.2356.python-list at python.org...
> hi!
>
> am trying to create a dll out of a .c file using VC++ 6.0
>
> This is the error am getting
> LINK : fatal error LNK1104: cannot open file "python21_d.lib"
>
> what should i be doing to rectify this?

You should be building for release, not for debug.

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


Alex







More information about the Python-list mailing list