Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

Christoph Zwerschke cito at online.de
Wed Feb 8 03:39:19 EST 2006


Martin v. Löwis wrote:
> Christoph Zwerschke wrote:
>> I understand what you mean. But the Postgres dll provides no means to
>> fdopen a new stream.
> 
> Right. So you must do so in the pygresql module. That means you have
> to get hold of msvcrt.dll's (sic) fdopen implementation.
> 
> One way to do so would be through linking pygresql to msvcrt.dll,
> instead of linking it to msvcr71.dll.

I think this would only shift the problem. Because then I would have to 
convert the msvcr71 stream I get from Python to a msvcrt stream. Using 
fileno() (of msvcrt) to get the file descriptor will probably not work.

> The other option is to use GetProcAddress to obtain the address of
> fdopen.

That would be an option. However, I would need to know the handle of the 
PostgreSQL dll module. Is there an easy way to get it (without having to 
hard-code the explicit name of the dll)? In any way, it seems I have to 
insert a lot of platform-dependent, ugly code.

In my case, it is probably easier to simply mimic the Postgres PQprint() 
function provided by the dll in PyGreSQL. It is not such a complicated 
thing. Plus it is only called with fixed parameters, so I don't need the 
complete functionality. PQprint() is considered obsolete anyway and may 
vanish one day.

But thanks a lot for your help. Sometimes you don't know whether you're 
doing something terribly wrong or missing a very easy solution if you 
don't discuss with others.

-- Christoph



More information about the Python-list mailing list