Re: ESQL/C & shared libraries?
Posted in 1996
}From: jlumbley@netcom.com (Joe Lumbley) }Date: Wed, 17 Jan 1996 18:18:53 GMT }X-Informix-List-Id: <news.20345> } }Folks, } }I've run across an interesting problem compiling ESQL/C code on a Stratus }FTX (SysV.4) system using 7.11 OnLine. } }I'm trying to create dynamically-linked shared libraries and the ESQL/C }functions seem to be a problem. What I'm doing is creating a shared object }file called libaedbcom.so. This contains functions for our API that get }data from the database. This is a .ec file that we're compiling with the }-G flag to create shared objects. Everything compiles and links OK, }until you try to run the code. Then you get a "relocation error 18" when }you try to run the executable. When I manually go into the .c code }generated by the compiler, if I comment out all of the "_iq" functions, }the program will run without crashing (or actually doing anything either). Are you compiling with the correct PIC flag (-K PIC on Solaris; I know not what on Sequent). You need to tell the compiler to produce code for shared libraries, as well as linking the various files into a shared object. }If I just compile the code without trying to create a shared library, }the code works fine. It would -- you need the equivalent to -K PIC. }Any ideas? How about it from the inestimable Mr/Ms Leffler, Tong, Kosenko, }and all the Informix source-code hackers? Am I trying to do the impossible? It should not be impossible. But some shared library systems are noticably easier to use than others. For example, the System V Release 3 shared libraries are a pain, but the SVR4 ones are pretty straight-forward. The -G option is reminiscent of SVR4, and -K PIC is SVR4 too. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>