Actually, I posted the dll and 3 test scripts (the two here, plus one non-threaded) to the sourceforge site, hoping for either a clue or a bugfix.
I think I did use the extending/embedding doc you sited, along with the O'Reilly books, when I was teaching myself to write extensions. I don't recall anything much related to threading, except Py_BEGIN/END_ALLOW_THREADS, which I think just deals with blocking, which I suspect is a different (and irrelevent?) issue here.
Thread blocking _is_ relevant if the .dll you are calling is not reentrant. You really need to refer to the documented thread behavior / requirements of the dll you are trying to interface to - there is no magic right answer on the Python end. What you need to do in your C extension depends totally on the internals of the dll you are calling. While it may be worth a shot to post your problem to comp.lang.python to try to get help from other C extension writers, they will probably not be able to help much either without knowing more about the threading constraints of the particular dll you are working with. Your best bet right now is to contact the maintainers of that dll (or read their developer docs) and find out what kinds of threading issues apply. Brian Lloyd brian@zope.com Software Engineer 540.361.1716 Zope Corporation http://www.zope.com