Re: compilation problem
Posted in 2004
"Danny Wright" <dwright@sherwoodfoods.com> wrote on 09/07/2004 01:30:47 PM: > I'm trying to compile a C program which calls a library function which is in > a file with some other library functions which use retquote() and retint(). Those are old I4GL functions. If you're linking with a 7.31 or later I4GL library, include the I4GL header, "fglsys.h", so that the correct mapping is done for you. The file has been around for a long time -- it will work for you with older versions of I4GL (from about 4.14/6.02 upwards, but you shouldn't be using anything more archaic than that). > Even though the particular library function I'm calling doesn't use those, > since they are referenced in the source file, I'm getting "undefined symbol" > errors. [*See below if that's unclear] > > I can think of several ways around this, but I'd like to avoid: > > 1: Splitting up the source file with the library functions Quite a good solution, actually. In particular, the library should definitely keep stuff dependent on I4GL separate from generic code, precisely so as to avoid the problems you're having. You should not be forced to link the entire I4GL library system just to resolve a reference that is never executed - the library design (your library) is...how shall we say it diplomatically?...less than ideal? > OR > > 2: Doing something kludgey like defining local versions of retquote() and > retint() (which would work, since the functions that call those are not > used by my program). int retquote(void) { assert(0); } int retint(void) { assert(0); } Should really fix the declaration to match fglsys.h, but ... Effective, but... > OR > > 3: Implementing the library function locally. > > I'd rather just fix it from the command line, but I'm having trouble > figuring out what library I should use. > > Is that possible? > > This is how the file is being built right now: > > cc -O -c -I/appsrc/incl problem.c > cc -s -o problem problem.o -L/appsrc/lib -lteca The simplest way to fix I4GL linking problems is to use the c4gl script: c4gl -s -o problem problem.o -L/appsrc/lib -lteca > I've tried tacking on "-L$INFORMIXDIR/lib/tools -l4gl", but that only > increases the number of undefined symbols (although it's not complaining > about retquote() or retint() anymore). > --------- > * - if the above was unclear, here's another way of describing it: > [...snip...thanks...] > /* as clear as an unmuddied lake, no? */ Quite clear - thanks. -- Jonathan Leffler (jleffler@us.ibm.com) STSM, Informix Database Engineering, IBM Data Management 4100 Bohannon Drive, Menlo Park, CA 94025 Tel: +1 650-926-6921 Tie-Line: 630-6921 "I don't suffer from insanity; I enjoy every minute of it!"