Re: Problem linking .a files
Posted in 1996
Pete, Which file contains your main routine? Without a main() (or MAIN ... END MAIN) somewhere, there is nothing to force any of the libraries to deliver up any of their goodies -- there are no references to be satisfied by them. The globals.o file is picked up because it it is forcibly listed on the command line. Somewhere, I think, there is a trivial main() which doesn't do anything useful, and doesn't reference anything significant -- you need to get the one you really want linked. There must be one, else the link would fail. But I'd suggest that there should be something like main.o on the command line, right at the beginning and in front of any libraries. Also, and just an FYI, the -a option does not affect the linking; it only affects the c-code generation phase of the compiler. It can be omitted from the link line. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: stiglich@interserv.com }Date: 1 Aug 1996 05:26:43 GMT }X-Informix-List-Id: <news.26745> } }I am having a problem linking a program together. The below script worked }on Sunos 4.1.3 & Informix Online 5.03. On a Solaris 2.5/Informix Online 7.13 }it seemingly works. It doesn't return any errors, but the size of the file is not }nearly what it should be. Using nm, I can see that the globals.o file is linked, }but it doesn't seem anything else is. } }Any help would be gratefully accepted. } }Thanks } }Pete } }P.S. Please reply via mail } }c4gl -a -static \\ }./scripts.a ./admin.a \\ }./protel.a ./lib.a \\ }./scripts.a ./lib.a \\ }./protel.a ./lib.a \\ }./protel.a ./admin.a \\ }./protel.a ./lib.a \\ }./scripts.a \\ }./inetcomm.a \\ }./SOCKET.a \\ }../globals.o \\ }/usr1/informix/lib/tools/libfesql.a \\ }/usr1/informix/lib/tools/libasf.a \\ }/usr1/informix/lib/tools/netlib.a \\ }/usr1/informix/lib/tools/libgen.a \\ }/usr1/informix/lib/tools/libos.a \\ }/usr1/gnu/lib/gcc-lib/sparc-sun-solaris2.3/2.6.1/libgcc.a \\ }-L/usr1/gnu/lib/FORCENOUSE -L/usr/lib -L/usr/lib/gcc-lib \\ }-lm -lsocket -lnsl -laio \\ }MINIVIEW.a \\ }-o proteldl.4ge