On Tue, May 22, 2001 at 01:06:22PM +0100, LxS wrote:
a) At the last UEA meeting, I heard ALUG had been offered a 25% O'Reilly discount. I thought, mmm, munch. Is this going to be honoured as an ALUG-library only option, or if I come up with a huge order can I route it thru ALUG?
I bet O'Reilly didn't give discount for the sake of their health - I bet they are hoping to get extra business so it's probably worth a try. The only restriction I remember hearing is that all the books have to go to the same address which is currently DF.
b) I'm trying to build and link against a static library: gcc -g -Wall -o libdog.o libdog.c ar rcs libdog.a libdog.o gcc -g -Wall -o sll.o sll.c ld -L. -ldog -o sll sll.o
The ld command warns me that it can't find a _start symbol...
Because you aren't linking crt0.o or whatever the startup module is called on Linux (the module that normally calls the C main() function). Maybe this is what you intended but if it isn't, the easiest fix is to use gcc as the linker, e.g:
gcc -L. -o sll sll.o -ldog
then wibbles about undefined symbol speak. It definitely finds libdog.a though (from -verbose), and nm libdog.a reports something very much like:
[snip]
What is happenning is that, because you have the -ldog option on your link command before the module that uses the speak symbol, at the time the linker searches the libdog.a library it doesn't yet know that it needs the function speak and won't bother including it. Later on it finds it needs a function called speak but it doesn't go back and re-search libraries it has already searched and it gets to the end of the list of modules and libraries with the symbol undefined.
In most cases, the answer is to put the libraries at the end of the link command and make sure the order is correct. For your case it looks simple enough:
ld -L. -o sll sll.o -ldog
It can get tricky with stuff that is mutually or circularly dependant but you can include libraries in the search list more than once to solve that.
Steve.