custom C function problem

From: "Dan \"Heron\" Myers" <heron(at)xnapid(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: custom C function problem
Date: 2008-05-03 17:27:36
Message-ID: 481CA088.20309@xnapid.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-05-03 17:50:35 Re: custom C function problem
Previous Message Tom Lane 2008-05-03 17:27:14 Re: clustering without locking