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