A "linking" Question

Поиск
Список
Период
Сортировка
От Terry Lee Tucker
Тема A "linking" Question
Дата
Msg-id 200406030908.40056.terry@esc1.com
обсуждение исходный текст
Ответы Re: A "linking" Question
Список pgsql-general
Let me explain:

I have written a "C" function which contains calls to other functions, all of
which work with an API to a mileage database product called PCMiler. These
functions make connections to the PCMiler databae, do error checking on the
origin and destination, get directions, etc. There is only one function
loaded into postgres and it makes calls to everything else. I create a shared
object library containing one object file: pcmiler.o and also containing a
link to the PCMiler SO, libpcmsrv.so. Here is the make file code:

libpcmiler.so: utility/pcmiler.h logpro.h utility/pcmiler.c
    rm libpcmiler* -f
    gcc -Wall -fPIC $(APPINC) -DUNIX -c utility/pcmiler.c
    gcc -shared -W1,-soname,libpcmiler.so.1 $(PCMSRVLIB) -o libpcmiler.so.1.0
pcmiler.o
    ln -s libpcmiler.so.1.0 libpcmiler.so.1
    ln -s libpcmiler.so.1 libpcmiler.so
    psql rnd < sqlfunc/loadCfuncs.sql

The function loads into postgres and everything works flawlessly. Now, we have
an X-Windows front end to this application which is a transportation app.
Obviously, we need to do lots of mileage lookups. There are times when I need
to make call to some of the functions residing in pcmiler.c bypassing the
call to the postgres function. I thought I could simply link my pcmiler
shared library with my app binary, but I get errors when I do that. Here they
are:
 pcmiler.o(.text+0x8d): In function `PCMilerConnect':
: undefined reference to `elog'
pcmiler.o(.text+0x12a): In function `PCMGetMiles':
: undefined reference to `elog'
pcmiler.o(.text+0x166): In function `PCMGetMiles':
: undefined reference to `elog'
pcmiler.o(.text+0x3c3): In function `psql_pcmgetmiles':
: undefined reference to `pg_detoast_datum'
pcmiler.o(.text+0x3d7): In function `psql_pcmgetmiles':
: undefined reference to `pg_detoast_datum'
pcmiler.o(.text+0x3ff): In function `psql_pcmgetmiles':
: undefined reference to `CurrentMemoryContext'
pcmiler.o(.text+0x406): In function `psql_pcmgetmiles':
: undefined reference to `MemoryContextAlloc'
pcmiler.o(.text+0x423): In function `psql_pcmgetmiles':
: undefined reference to `CurrentMemoryContext'
pcmiler.o(.text+0x42a): In function `psql_pcmgetmiles':
: undefined reference to `MemoryContextAlloc'
pcmiler.o(.text+0x48a): In function `psql_pcmgetmiles':
: undefined reference to `elog'
pcmiler.o(.text+0x4dc): In function `psql_pcmgetmiles':
: undefined reference to `pfree'
pcmiler.o(.text+0x4ea): In function `psql_pcmgetmiles':
: undefined reference to `pfree'
pcmiler.o(.text+0x51f): In function `psql_pcmgetmiles':
: undefined reference to `Float8GetDatum'
collect2: ld returned 1 exit status
make: *** [logpro] Error 1

All the complaints are regarding pgsql server functions. Obviously, I need to
link with some sort of library, but I don't know which one. I'm already
linking with libpq and I tried libepcg but that didn't work. I'm not very
knowledgeable regarding some of these things so please excuse my ingorance.
Can somebody give me a clue as to the error of my ways?

Thanks...

--
Quote: 6
"[G]un control often serves as a gateway to tyranny. Tyrants from Hitler
 to Mao to Stalin have sought to disarm their own citizens, for the simple
 reason that unarmed people are easier to control. Our Founders, having
 just expelled the British army, knew that the right to bear arms serves
 as the guardian of every other right. This is the principle so often
 ignored by both sides in the gun control debate. Only armed citizens can
 resist tyrannical government."

 --Ron Paul

 Work: 1-336-372-6812
 Cell: 1-336-363-4719
email: terry@esc1.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Jack Orenstein
Дата:
Сообщение: Re: Page access pattern in query plan using index scan
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: A "linking" Question