extending python

Discussion in 'Python' started by Ajay, Sep 29, 2004.

  1. Ajay

    Ajay Guest

    hi!

    does the init<modulename> function has to have a PyMODINIT_FUNC return
    type.
    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?

    thanks

    cheers






    ----------------------------------------------------------------
    This message was sent using IMP, the Internet Messaging Program.
    Ajay, Sep 29, 2004
    #1
    1. Advertising

  2. Ajay <> 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).

    Cheers,
    mwh

    --
    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
    Michael Hudson, Sep 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John D

    Extending the python language

    John D, Sep 16, 2003, in forum: Python
    Replies:
    1
    Views:
    294
    Simon Burton
    Sep 17, 2003
  2. Luke
    Replies:
    3
    Views:
    505
    Robin Becker
    Oct 24, 2003
  3. Johannes Zellner
    Replies:
    1
    Views:
    330
    Fredrik Lundh
    Jan 18, 2006
  4. Kiran
    Replies:
    5
    Views:
    283
    Kiran
    Oct 26, 2006
  5. Kiran
    Replies:
    3
    Views:
    622
    Kiran
    Oct 26, 2006
Loading...

Share This Page