Subject: RE: linking application with a library
From: David Korn <[email-masked]>
To: "'Mohammad Saleem'" <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 19 Nov 2001 12:00:34 -0000

-----Original Message-----
>From: Mohammad Saleem [mailto:[email-masked]]
>Sent: 18 November 2001 11:46

  Hiya Mohammad, I can see a couple of things here:

>Even with link I tried with a flag --gc-sections 

  D'oh, yes, sorry, I should have mentioned that one.

>test.srec: $(OBJ) appcon.o
>    $(LD) --gc-sections $(LDFLAGS)   $^ mylib.a $(LIBS) -o $@

  But you are linking mylib.a as if it were an object file!  I think it
needs to be supplied with a -l flag to be treated as a library, does it
not ?  Try renaming mylib.a to libmylib.a (ld requires the name to be in
the format libXXXX.a and then you use -lXXXX), and then try using the
ld line in the makefile like

>    $(LD) --gc-sections $(LDFLAGS)   $^ -lmylib -L. $(LIBS) -o $@

 - ie we tell it that we want the library mylib, it knows then to look for
'libmylib.a', and the -L. tells it that the lib may be found in the 
current directory.

>********************************************
>compiling appcon.c
>h8300-hitachi-hms-ld: warning: no memory region specified for section `.
>_init'
>h8300-hitachi-hms-ld: warning: no memory region specified for section 
>`.configu'
>h8300-hitachi-hms-ld: warning: no memory region specified for section 
>`.timerIn'
>*************************************************

  This may reflect a problem with the srec format limiting the length of
section name strings, but see if it goes away when you try the new flags.

       DaveK
--
Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/