AW: FW: Postgresql on win32

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'Magnus Hagander'" <mha(at)sollentuna(dot)net>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: AW: FW: Postgresql on win32
Date: 2001-01-22 11:31:10
Message-ID: 11C1E6749A55D411A9670001FA6879633681CB@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> > The problem is that there are strings being allocated from
> > libpq.dll using PQExpBuffers (for example, initPQExpBuffer()
> > on line 92 of input.c). These are being allocated using the
> > malloc function used by libpq.dll. This function *may* be
> > different from the malloc function used by psql.exe - only
> > the resulting pointer must be valid. And with the default
> > linking methods, it *WILL* be different. Later, psql.exe
> > tries to free() this string, at which point it crashes
> > because the free() function can't find the allocated block
> > (it's on the allocated blocks list used by the runtime lib of
> > libpq.dll).

It is possible to make the above work (at least on MSVC).
The switch is /MD that needs to be used for both the psql.exe and
libpq.dll. This forces the use of Multithreaded DLL runtime libraries.
The problem at hand is, that it uses different runtime libs for dll and exe
per default, if both use the same runtime libs it is possible to malloc in
the dll and free in the exe.

Andreas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2001-01-22 11:37:16 timestamp (mis)behaviors
Previous Message Zeugswetter Andreas SB 2001-01-22 10:50:20 AW: like and optimization