python - dll access (ctypes or swig)

Thomas Heller theller at ctypes.org
Wed Apr 18 11:36:48 EDT 2007


Alex Martelli schrieb:
> Larry Bates <larry.bates at websafe.com> wrote:
>    ...
>> I guess I was the only one it wasn't "obvious" to <grin>.  I've always
>> written my COM servers as .EXE files even though they cannot be run
>> independently.  What I find is "odd" is that I can create a .DLL or an
>> .EXE of my COM server and after I register it, my application doesn't
>> appear to know the difference.  The difference seems to be hidden from
>> the actual application and doesn't affect it (at least that I can
>> determine).
> 
> Yes, except for performance (a DLL affords within-process communication
> without the overhead of IPC, so it can be much faster when appropriate)
> and some technical issues such as threading (if COM client and server
> are in separate processes, their threading models are independent from
> each other; if they are in the same process, they'd better have
> compatible threading approaches -- a thread-unsafe DLL server can make a
> single-threaded client happy but would cause problems and crashes if a
> freely-threaded client tried using it).

I think that the latter problem (incompatible threading models in the same
process) are solved by COM apartments - aren't they?

Thomas




More information about the Python-list mailing list