Andres K. Foerster wrote:
Am Thursday, dem 03. Nov 2005 schrieb Frank Heckenbach:
vanam srihari kumar wrote:
How to call the linker explicitly in gpc 2.1 version.
Via GPC, you can just call GPC with object files:
gpc -o foo foo.o bar.o baz.o
Without GPC, you can call ld, but have to add the GPC runtime library (`gpc -print-file-name=libgpc.a' gives the file name) and -lm.
Can I use that to compile code on my local machine and link it on a machine, where gpc is not installed? (same OS, same machine type, but different library versions)
Is it enough to copy the file libgpc.a, or what else do I need?
Normally, libgpc.a and all object files should be enough. (Of course, if you use external libraries such as ncurses, you need them as well on the other machine.)
In fact, in order to distribute one of my non-free programs in object code format (to satisfy LGPL requirements from some libraries used), I put all the object files into one .a file (including the main program's object file, though putting it in a "library" .a file seems strange at first glance) and distribute this .a file plus libgpc.a, so it can be relinked without having GPC installed. I've tested this (some years ago) under Linux, DJGPP and Solaris and it worked.
Frank