Re: Problems using palloc in postgresql user C functions
От | Joe Conway |
---|---|
Тема | Re: Problems using palloc in postgresql user C functions |
Дата | |
Msg-id | 3E77FD4F.3040700@joeconway.com обсуждение исходный текст |
Ответ на | Re: Problems using palloc in postgresql user C functions (John Gunther <inbox@bucksvsbytes.com>) |
Ответы |
Re: Problems using palloc in postgresql user C functions
|
Список | pgsql-novice |
John Gunther wrote: > Thanks for the fast, late night answer. I've got that much. But when I > compile and link my library with those statements (using libtool and > gcc) I get "undefined reference" errors for the following: textin, > textout, DirectFunctionCall1, CurrentMemoryContext, MemoryContextAlloc, > and pg_detoast_datum. Handling these errors is where my understanding > fails? Can they be ignored somehow because they will be resolved at > execution time? It looks like they're fatal and preventing the library > from being created. > No, they can't be ignored. I'd guess you need the following includes at a minimum: #include "postgres.h" #include "fmgr.h" Beyond that, you may need: #include "utils/builtins.h" and if you are using SPI: #include "executor/spi.h" and possibly others. The bottom line is you need to find the header file that defines the functionality you want to use. I recommend you read: http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/xfunc-c.html (use the "Version-1 Calling Conventions for C-Language Functions" _not_ Version-0). And like I already mentioned, studying one or more of the contrib libraries closely would be a very good idea. Joe
В списке pgsql-novice по дате отправления: