- E02 - Support for MinGW Open Source Compiler

Stephen Kellett snail at objmedia.demon.co.uk
Mon Feb 14 14:51:44 EST 2005


In message <1108409476.874751.16600 at l41g2000cwc.googlegroups.com>, Pat 
<pobrien at orbtech.com> writes
>if I have both versions of Python installed - 2.3.5 and 2.4?  Is there
>an easy way to detect this and switch between the two dlls?

Easy? Depends what you call easy.

a) You just need to detect if pythonNN.dll is implicitly linked to 
msvcrt.dll or msvcrXX.dll (where XX indicates a VS studio number, 
currently XX can only be 71, but if Python is done for Visual Studio 
2005 (8.0) then XX may also have a value of 80).

b) GetModuleHandle(name of DLL from a) to get the DLL handle.

c) GetProcAddress on the respective to get the C runtime function you 
want to call (for example, fopen).

d) call the function.

You either need (a) or all of (a)...(d) depending on what you are doing. 
Those embedding Python but no idea of the Python version in advance will 
do the latter.

>If I'm asking questions already answered elsewhere, I'd love a link to
>that resource, if you have it.

I'm probably not the best person to answer such a question. I'm mainly a 
C/C++ (with Java under protest) person dabbling in Python/Ruby.

Stephen
-- 
Stephen Kellett
Object Media Limited    http://www.objmedia.demon.co.uk
RSI Information:        http://www.objmedia.demon.co.uk/rsi.html



More information about the Python-list mailing list