[Pythonmac-SIG] error trying to run c extension from carbon Python

Magladry, Stephen stephenm@humongous.com
Wed, 19 Jun 2002 10:53:07 -0700


I am trying to run a c extension for a build of Python Carbon and when I try
to import the c extension, I get a "Interpreter not initialized (version
mismatch?)" error. Here's a run down of what I have done.

1. Tried to use stock Carbon Python. It isn't even able to import a new
sample library. It come back with a syntax error, some kind of stdin error
if I remember correctly. 
2. Needed to modify the Carbon project. As built, It doesn't support Dynamic
Loading. I added the three options USE_MAC_SHARED_LIBRARIES,
USE_MAC_APPLETE_SUPPORT and  HAVE_DYNAMIC_LOADING.
2.5 Also use the call PYMac_Initialize() instead of PY_Initialize().
3. Add the necessary supporting c files in order to get Carbon Python with
the above library support linking.
3.5 Use dyload_mac.c in place of dynload_stub.c.
4. Rebuild PythonCarbonCore using the config.h files as the above project.
5. Build a simple c extension that weak links to the newly created
PythonCarbonCore.
6. Move the new created, PythonCarbonApp, PythonCarbonCore and myLibrary to
the same folder. 
7. Fire up The Python interpreter.
8. Enter the command Import myLibrary, with the library file named
"myLibrary.carbon.slb".
9. Get the error "Interpreter not initialized (version mismatch?)".

I have stepped through the code at the interpreter level and the last line
of code that gets executed, at least at the interpreter level is
GetDiskFragment, line 86 in dynload_mac.c. If I try to step over this line
of code, I get the error.

Questions:

1. Anyone know why I'm getting this error? It doesn't seem like I have a
version mismatch since everything is running off the same code base.
2. Does anyone see something glaring that I have done wrong?
3. Has anyone been able to set up a Python Carbon that is able to call c
extensions?
4. Is it even possible in the current state to have the Carbon code call a c
extensions?


Thanks for your time,


Stephen Magladry