extending python

Michael Hudson mwh at python.net
Wed Sep 29 14:05:01 CEST 2004

Ajay <abra9823 at mail.usyd.edu.au> writes:

> hi!
> does the init<modulename> function has to have a PyMODINIT_FUNC
> return type.

Well, er, it has to have certain things declared about it in some
circumstances and PyMODINIT_FUNC is probably the easiest way to
acheive this.  Woolly enough for you? :-)

> i am building PyOpenSSL for a pocket pc using embedded visual c++ and i am
> doing so by putting together all the C files together for OpenSSL/crypto
> and building crypto.pyd
> now crypto.c has void initcrypto
> Build works fine. But when i import it, i get an error saying dynamic load
> module does not define an init function (initcrypto)
> the same build using VC++ 6.0 works fine on the PC and i can even import
> it.
> any ideas?

Well, I guess your module init function *is* declared a
PyMODINIT_FUNC?  Can you find out what it is expanding to?  I guess
it's not right?

I think it needs to be __declspec(export) or something like that (but
I'm not a Windows user; don't take my word for it).


  We've had a lot of problems going from glibc 2.0 to glibc 2.1.
  People claim binary compatibility.  Except for functions they
  don't like.                       -- Peter Van Eynde, comp.lang.lisp

More information about the Python-list mailing list