need help porting ctypes to Linux

Thomas Heller theller at python.net
Tue Nov 19 14:28:16 EST 2002


I recently announced ctypes, see
http://starship.python.net/crew/theller/ctypes.html

I've got some enthusiastic responses, and also some requests to port
this to other systems. So I'm currently porting it to Linux.

I have an early version running, but I have some questions for
experienced linux people.  Certainly off-topic here, but I hopefully I
get bright answers fast also to these questions.  Here we go:

Section A: libffi

1.  I use Anthony Green's libffi. I subscribed to the mailinglist at
redhat and asked questions there, but no response so far.  This list
seems pretty dead.  From what I found on the web, libffi is included
in gcc starting with 3.0 or so.  I cannot check this myself, I use an
oldish suse 7.0 linux here. Is it correct that libffi is still covered
by the MIT license, and not GPL or LGPL?


2.  I would like to throw away some of my own code and use libffi
instead also for Windows.  Since libffi uses gnu's assembler syntax,
it would be easiest to crosscompile the library under linux for
Windows, at least for starting.  I've heard this is possible using
MingW, is this correct?  (Ahem) In this case, would some kind soul be
willing to do it?


Section B: general linux questions

3.  When my extension does something wrong, I see
'Speicherzugriffsfehler' ('access violation' or so) printed on the
console.  Why isn't a core dump (for examination) created? Do I have
to enable this?  Or is it possible to configure gdb so that it will
automatically pop up to examine the program's state?

4.  When I have undefined symbols in my shared extension module, I get
an 'ImportError: /.../_ctypes.so: undefined symbol: blabla' when the
module is loaded. Is this normal? Why doesn't the linker complain?


Section C (and now we're on-topic again): understanding the Python
interpreter lock

5.  I got crashes when using callbacks, they vanished when I called
PyEval_InitThreads().  This was unneeded on Windows, I assume because
on Windows PyEval_InitThreads() has been called before.  My question
is: why do I have to call this function on Linux, but not on Windows?
Does it do any harm if I call the function when the ctypes module is
loaded, or should I wait until the callbacks are actually needed?


Thanks for any advice,

Thomas



More information about the Python-list mailing list