The part I was and am still a bit confused about is name clashes. If I understand correctly, python extension modules are supposed to only export the initmodule method in order to avoid name clashes, which is why the docs say everything should be static. But if bitmask is linked in to the module, then won't it's functions be exported? If not, then is it possible for me to call them, or do I need to link bitmask into my code as well? And how is bitmask different than SDL in terms of how it's linked, if at all?

Sorry, I feel like I'm saying a bunch of nonsense, but I'm having a hard time making sense of all this dynamic linking stuff.

What I'm doing now is adding a CObject to the mask module for the PyMask_Type, and then compiling my code against bitmask.h (which I'm leaving as-is) and mask.h (which looks like some of the other header files, and exports a C API with a bunch of #defines). So I'm assuming I'll need to use CObjects to get at stuff in mask.c (the Type in particular), but I can link directly to the stuff in bitmask.

On an unrelated note, I'm looking at font.h as an example for exporting the api, and I was wondering in the import_pygame_font why the code does a memcpy instead of just changing the PyFONT_C_API pointer. Isn't there a danger of the memcpy stomping on something else, since it's copying 3 things into a 1-element array?

--Mike

Lenard Lindstrom wrote:
Hi Michael,

bitmask.c is statically linked to mask.c as an object file. On Windows the distutils package ensures only the initmask function is exported as an entry point into the mask.pyd DLL. Unix dynamic libraries may be more liberal as to what is exported, but Python will only directly call the module initialization function, so no problem.

Setup.in controls extension builds. This is like a make file. Each extension module, like mask, has its own line, or dependency entry. A new C module can be added to an extension module by adding its source file to an extension module entry. Be sure to run config.py afterward to build the Setup file used by setup.py.

Lenard

Michael George wrote:

Greetings,

[snip]


I'd be happy to spend some time and submit a patch, but I'm not quite sure how it should work. Should mask.c access the bitmask.c functions through the exported function table? Should mask.c just #include bitmask.c? Any thoughts?

[from another post in this thread]
>
>  Understanding the build system(s) is a bit daunting.

--Mike



Reply via email to