473,804 Members | 3,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A "linking" Question

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,libpcmil er.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_pcmgetmil es':
: undefined reference to `pg_detoast_dat um'
pcmiler.o(.text +0x3d7): In function `psql_pcmgetmil es':
: undefined reference to `pg_detoast_dat um'
pcmiler.o(.text +0x3ff): In function `psql_pcmgetmil es':
: undefined reference to `CurrentMemoryC ontext'
pcmiler.o(.text +0x406): In function `psql_pcmgetmil es':
: undefined reference to `MemoryContextA lloc'
pcmiler.o(.text +0x423): In function `psql_pcmgetmil es':
: undefined reference to `CurrentMemoryC ontext'
pcmiler.o(.text +0x42a): In function `psql_pcmgetmil es':
: undefined reference to `MemoryContextA lloc'
pcmiler.o(.text +0x48a): In function `psql_pcmgetmil es':
: undefined reference to `elog'
pcmiler.o(.text +0x4dc): In function `psql_pcmgetmil es':
: undefined reference to `pfree'
pcmiler.o(.text +0x4ea): In function `psql_pcmgetmil es':
: undefined reference to `pfree'
pcmiler.o(.text +0x51f): In function `psql_pcmgetmil es':
: 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: te***@esc1.com

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 23 '05 #1
2 2686
On Thu, Jun 03, 2004 at 09:08:40AM -0400, Terry Lee Tucker wrote:
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:
<snip>
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?
There is no library with those functions. They exist within the server
binary itself and are exported to dynamically linked modules that are
loaded in.

I think you need to split your library in two, one part which depends
on being loaded into postgresql and the part that can be used standalone.

--
Martijn van Oosterhout <kl*****@svana. org> http://svana.org/kleptog/ Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFAvyyeY5T wig3Ge+YRAoJmAK DGSV58U6iJOw9VF bb/2LUAm8E4dACgj0F k
hibPvJCWJPRJM04 quNCyzsc=
=wIb/
-----END PGP SIGNATURE-----

Nov 23 '05 #2
Ah, that's the information I needed. I already have a "split" version, I just
wanted to know if it was possible to it the other way. You've been very
helpful.

Thanks...

On Thursday 03 June 2004 09:50 am, Martijn van Oosterhout saith:
On Thu, Jun 03, 2004 at 09:08:40AM -0400, Terry Lee Tucker wrote:
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:


<snip>
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?


There is no library with those functions. They exist within the server
binary itself and are exported to dynamically linked modules that are
loaded in.

I think you need to split your library in two, one part which depends
on being loaded into postgresql and the part that can be used standalone.


--

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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
5133
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is relative NOT to the immediate script that is including it, but is relative to the top-level calling script. In practice, this means that you have to constantly worry and adjust paths in includes, based on the startup scripts that call these...
4
2538
by: J. Campbell | last post by:
From reading this forum, it is my understanding that C++ doesn't require the compiler to keep code that does not manifest itself in any way to the user. For example, in the following: { for(int i = 0; i < 10; ++i){ std::cout << i << std::endl; for(int j = 0; j < 0x7fffffff; ++j){} } }
87
5268
by: ziliath | last post by:
I recently tried out the Google "top coder" contest, as a C++ coder. I noticed immediately that they expected me to know STL. To which I say, what the fuck?! I may be missing something, but at what point when learning C++ was I supposed to have picked up STL? I ask because at every job I've had, and every job interview for that matter, whenever STL comes up it's not I, but a manager who says effectively yuck, we don't use that crap.
6
2538
by: Don Leverton | last post by:
Hi All, I've got a situation where I am developing an Access 97 app for a client, and am in the "beta testing" stage. I have split the app up, using the DB splitter, into front-end /back-end for the usual reason ... so I can mess with form/report revisions. Since splitting, I've had issues with re-linking the tables ... as it relates to the completetely different "My Documents" data paths on several different Win98 / Win XP computers.
2
2236
by: Paul E Collins | last post by:
I'm considering using the NetSpell spell checking engine in my application. However, NetSpell is licensed under the Lesser GPL, and I want to withhold my application's source code. The licence states that I can do this if I link to the NetSpell library dynamically (rather than compiling against it statically). How can I achieve this in C#? P.
21
2645
by: Chen ShuSheng | last post by:
Hey, In head file 'stdio.h', I only find the prototype of these two function but no body. Could someone pls tell me where their bodies are ? -------------- Life is magical.
3
7385
by: jclover | last post by:
When creating a query in Access (assumption is the data has a unique ID which is numerical...new records, autonumber) how reliable is the "Last of" grouping function vs the "Max of" the ID, and then linking that max of with a record in another query. I've had issues in the past where the "last" record, isn't necessarily the last record entered. In my case, I'm updating product pricing, so I always want to pull the most recently entered...
25
20585
by: tekctrl | last post by:
Anyone: I have a simple MSAccess DB which was created from an old ASCII flatfile. It works fine except for something that just started happening. I'll enter info in a record, save the record, and try to move to another record and get an Access error "Record is too large". The record is only half filled, with many empty fields. If I remove the added data or delete some older data, then it saves ok and works fine again. Whenever I'm...
4
8068
by: naveenmurthy | last post by:
Hello All, I have created a .mht file in following format. 1. The .mht file contains following htmls. a. MHTLinkingProblem.html b. Left.html c. Right.html d. Start.html
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.