esql link error
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Firstly, thanks to all of you who helped last time :) Currently I am trying to compile some libraries but when linking the object files with esql I get the error message :- undefined reference to main Because I am creating a library which will be used by other programs, there is no main in the code . How do I stop this error ? what's going on!!
John Horton wrote: > > Firstly, thanks to all of you who helped last time :) > > Currently I am trying to compile some libraries but when linking the object files > with esql I get the error message :- > undefined reference to main > Because I am creating a library which will be used by other programs, there is no main in the code . How do I stop this error ? what's going on!! Are you trying to make an object library or a shared library? For an object library just compile with the -c flag and use ar to build the library. To build a shared library you need to pass the -G flag to ld which you can not do with esql without modifying the script because -G is meaningful to esql. Art S. Kagel
"Art S. Kagel" wrote:
> John Horton wrote:
> >
> > Firstly, thanks to all of you who helped last time :)
> >
> > Currently I am trying to compile some libraries but when linking the object files
> > with esql I get the error message :-
> > undefined reference to main
> > Because I am creating a library which will be used by other programs, there is no main in the code . How do I stop this error ? what's going on!!
>
> Are you trying to make an object library or a shared library? For an
> object library just compile with the -c flag and use ar to build the
> library. To build a shared library you need to pass the -G flag to ld
> which you can not do with esql without modifying the script because -G is
> meaningful to esql.
Actually, there is a way to get the -G to the C compiler, though it is not as direct as you or I'd like:
INFORMIXC="gcc -G" esql -o libname.so objfile*.o
Also, on some machines, it appears that -shared works the necessary magic.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>