Linking to palloc and elog. (fwd)

Started by Robert J. Sprawlsalmost 26 years ago2 messagesgeneral
Jump to latest
#1Robert J. Sprawls
sprawlsr@worldnet.att.net

Hello,
I'm not too familiar with linking to pgsql libs. I've linked to
the static libpq libs before, but this is new ground. I'm following the
example in complex. When I try to link here is my errors:

gcc -g -I /usr/pgsql/include testepg.o compos.o vect3d.o -o testepg
compos.o: In function `compos_in':

/home/sprawlsr/devel/projects/galwars/misc/compos.c:10: undefined
reference to `elog'

/home/sprawlsr/devel/projects/galwars/misc/compos.c:14: undefined
reference to `CurrentMemoryContext'

/home/sprawlsr/devel/projects/galwars/misc/compos.c:14: undefined
reference to `MemoryContextAlloc'

/home/sprawlsr/devel/projects/galwars/misc/compos.c:16: undefined
reference to `elog'

There is more, but this should do it.

Robert J. Sprawls sprawlsr@worldnet.att.net
Tactical Dynamics http://home.att.net/~sprawlsr
CEO (Chief Everything Officer)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert J. Sprawls (#1)
Re: Linking to palloc and elog. (fwd)

"Robert J. Sprawls" <sprawlsr@worldnet.att.net> writes:

gcc -g -I /usr/pgsql/include testepg.o compos.o vect3d.o -o testepg
compos.o: In function `compos_in':

/home/sprawlsr/devel/projects/galwars/misc/compos.c:10: undefined
reference to `elog'

Sounds like you're trying to make a standalone program from something
that's intended to be a dynamically loaded addon to the backend
(ie, a shared library). There are some examples in contrib/ of the
right way to do this.

regards, tom lane