Thread: C function linkage and testing
Hi All, This is my first posting to the list, so please be gentle. ;-) I'm writing a number of C SQL-extension functions and it occurred to me that I might need to debug these things as some point. If I want to create my own main () function to exercise my extensions, what Postgres libraries do I need to link against? For example, the VARSIZE and VARDATA macros are wrapped around internal functions; palloc and pfree also have dependencies. If I want to use these calls within my extensions, and I want to run my extensions separately for debugging / validation purposes, what libraries should I link against? Any help is welcome. Andrew Gold
Andrew Gold <agold@cbamedia.com> writes: > I'm writing a number of C SQL-extension functions and it occurred to me > that I might need to debug these things as some point. If I want to > create my own main () function to exercise my extensions, what Postgres > libraries do I need to link against? There are no libraries for backend internal functions, and I doubt that it would make any sense to provide such. (By the time you got done duplicating the behavior of palloc and elog, you'd have a mini-backend anyway --- you'd certainly not have a "library" that could be plugged into any random main program.) Usually people who want to debug such stuff just attach to a running backend with a debugger, and debug the code in the live environment. regards, tom lane