From: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | el dorado <do_ra_do(at)mail(dot)ru> |
Subject: | Re: C-procedure crashed in Postgres 8.3.3 when using 'text' variable (WinXP) |
Date: | 2008-07-15 15:37:52 |
Message-ID: | 487CC450.3020603@postnewspapers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
> el dorado <do_ra_do(at)mail(dot)ru> writes:
>> I'd like to write C-function returning text for using in PG 8.3.3. (WinXP SP2)
>> For compilation I use MinGW-5.1.4 (gcc 3.4.5),MSYS-1.0.10.
>
> Was the Postgres server you're using built the same way? I seem to
> recall some incompatibilities between MinGW and MSVC builds.
I'd be surprised if there weren't some given how tricky it is to mix
different compilers on Windows, where that usually means mixing C
runtimes as well. On any platform it's best to stick to the same C
runtime for all libraries to be linked into the same process*.
That said, PostgreSQL does appear to use its own allocator for memory
passed across library boundaries, and if it doesn't pass any FILE
pointers across library boundaries either then that's the worst two
problems that arise with a C runtime mismatch taken care of. As far as I
know, anyway, and I've had the misfortune to have to dig into it a bit.
It seems like a good idea to use the same version of the same compiler
that your version of PostgreSQL was built with anyway. If nothing else,
I've only taken a cursory look at the code and have little knowledge
about it, so there could well be code paths/uses where memory is
malloc()'d in one DLL and freed()'d in another, etc. I'm sure there all
sorts of other possible wrinkles, and it'd just be easier to stick with
the same compiler. You can download Visual Studio 2005 Express Edition
for free from MS.
* Thankfully UNIXes tend to be sane enough to use the same C library
across all C compilers installed (and generally stick to one compiler
anyway), so most of us are able to avoid this exciting little complication.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Mason Hale | 2008-07-15 15:38:15 | Re: vacuum taking an unusually long time |
Previous Message | Richard Huxton | 2008-07-15 15:17:54 | Re: Referential integrity vulnerability in 8.3.3 |