custom C function problem - Mailing list pgsql-general

From Dan \"Heron\" Myers
Subject custom C function problem
Date
Msg-id 481CA088.20309@xnapid.com
Whole thread Raw
Responses Re: custom C function problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I'm creating some custom C functions to load dynamically from a dll
(this is Postgres 8.3.1 on Windows XP SP2).  I have two that work fine,
but any time I try to write one that uses a text*, postgres crashes.
This is true even for the example functions like "copytext" given in the
documentation here:
http://developer.postgresql.org/pgdocs/postgres/xfunc-c.html

I'm compiling my DLL with MinGW.  I do CREATE FUNCTION as described in
the documentation, and then I do a "SELECT copytext(colname) FROM
tablename" (colname is a text column), at which point Visual Studio's
"Something in postgres.exe crashed.  Do you want to debug?" dialog pops
up.  (Of course, I click no and postgres appears to restart itself.)

Again, I have two other functions (neither of which uses a text*), both
of which I can successfully load into postgres (from the same dll file
as the function that crashes) and use in queries without problems.

Does anyone have any idea why this is happening?

- Dan

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: clustering without locking
Next
From: Tom Lane
Date:
Subject: Re: custom C function problem