linking one extension module to another (Mac OSX)

Discussion in 'Python' started by Simon Burton, Nov 22, 2005.

  1. Simon Burton

    Simon Burton Guest

    Hi,

    I'm having some trouble linking one extension module to another because
    the linker expects a "lib" prefix and my python modules cannot have
    this prefix.

    I found two ways of doing it on a linux box (either symlink or create a
    dummy .so that links to extension module) but I can get neither of them
    work on OSX (let alone windows).

    Simon.
    Simon Burton, Nov 22, 2005
    #1
    1. Advertising

  2. Simon Burton wrote:
    > I'm having some trouble linking one extension module to another because
    > the linker expects a "lib" prefix and my python modules cannot have
    > this prefix.


    This is a Good Thing (tm) :) Don't link extension modules to each
    other; this is really asking for trouble. Instead, come up with a
    function pointer API in one module, put that into a CObject, and
    access the CObject through import statements.

    Alternatively, make both extension modules link to the same
    backend library.

    Regards,
    Martin
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=, Nov 22, 2005
    #2
    1. Advertising

  3. Simon Burton

    Guest

    Martin v. Löwis wrote:
    > Simon Burton wrote:
    > > I'm having some trouble linking one extension module to another because
    > > the linker expects a "lib" prefix and my python modules cannot have
    > > this prefix.

    >
    > This is a Good Thing (tm) :) Don't link extension modules to each
    > other; this is really asking for trouble. Instead, come up with a
    > function pointer API in one module, put that into a CObject, and
    > access the CObject through import statements.
    >
    > Alternatively, make both extension modules link to the same
    > backend library.
    >
    > Regards,
    > Martin


    I have C Extension classes distributed across several modules with
    non-trivial interdependancies. I guess you are saying I should have
    these in backend libraries and then put the module specific functions
    in the module itself. It's going to be tricky because I am using
    distutils and pyrex to do all this. Maybe Greg (Ewing) has some other
    ideas.

    Thanks for the warning.

    Simon.
    , Nov 22, 2005
    #3
  4. wrote:
    > I have C Extension classes distributed across several modules with
    > non-trivial interdependancies. I guess you are saying I should have
    > these in backend libraries and then put the module specific functions
    > in the module itself. It's going to be tricky because I am using
    > distutils and pyrex to do all this. Maybe Greg (Ewing) has some other
    > ideas.


    Alternatively, if you are always shipping the entire set: make
    them all a single extension module.

    For backwards compatibility, provide Python modules with the "old"
    module names, which export the symbols that used to be in that
    module.

    Regards,
    Martin
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=, Nov 23, 2005
    #4
    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. Daniel Wetzler
    Replies:
    0
    Views:
    501
    Daniel Wetzler
    Jul 19, 2003
  2. Fortepianissimo

    How to link a C extension module on Mac OS X?

    Fortepianissimo, Jul 23, 2003, in forum: Python
    Replies:
    3
    Views:
    497
    Greg Ewing (using news.cis.dfn.de)
    Jul 28, 2003
  3. john skaller

    linking on OSX Snow Leopard

    john skaller, Oct 24, 2010, in forum: Python
    Replies:
    0
    Views:
    200
    john skaller
    Oct 24, 2010
  4. Robert Cohen
    Replies:
    3
    Views:
    249
    Andrew Durstewitz
    Jul 15, 2003
  5. Jeff Mitchell
    Replies:
    3
    Views:
    131
    Jeff Mitchell
    Jun 17, 2004
Loading...

Share This Page