Hello, I'm trying to get the following function to compile and keep getting
an error.
#include <postgres.h>
#include <string.h>
#include <fmgr.h>
PG_FUNCTION_INFO_V1(checkvisible);
Datum
checkvisible(PG_FUNCTION_ARGS)
{
FILE
*fp
;
BpChar *cpPtr;
cpPtr = PG_GETARG_BPCHAR_P(0);
fp = fopen("/u/randy/tst/randy.pgsqlout", "a+");
if (fp)
{
fprintf(fp, "5 2 cpPtr = [%s]\n", cpPtr->vl_dat);
fclose(fp);
}
switch (*(cpPtr->vl_dat))
{
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
PG_RETURN_BOOL(false);
break;
}
PG_RETURN_BOOL(true);
}
Here is what I'm doing to compile and the error I get.
gcc -shared -I/usr/include -I/dvlp/include -I/dvlp/src/qcinclude \
-I/dvlp/src/TRinclude -I/dvlp/src \
-I/dvlp/mis/randy/postgres/postgresql-7.2/src/include -DNLS -DUNIX5=1 \
-DSYS5 -USYS3 -DDELSTOP=1 -DATTRIB -DAIX \
-I:/usr/local/pgsql/lib/postgres.imp -o tstfunc.so tstfunc.c -lc -lm
ld: 0711-317 ERROR: Undefined symbol: .pg_detoast_datum
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
make: 1254-004 The error code from the last command is 1.
If I use the macro PG_GETARGS_POINTER() this compiles and links and I can use
it. Why does the function pg_detoast_datum not get resolved.
I have postgres 7.2 on AIX 4.3.3.
Thanks, Randy
PS. I've searched all your e-mail archives, and read all the documentation.
Maybe I'm just overlooking one include or define somewhere.