delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/10/22:01:48

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199607110154.AA101150059@relay1.geis.com>
Date: Thu, 11 Jul 96 01:39:00 UTC 0000
To: lolo AT einev0 DOT einev DOT ch
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: grx20, other question

Reply to message 6668799    from LOLO AT EINEV0 DOT E on 07/10/96  4:15AM


>But when I give a "gcc myprog.c .../grx20/lib/libgrx20.a" it's compile fine
>and my .EXE is working.

This is actually not the correct way to link the library - you should use the
-l compiler option, i.e.

gcc -Wall -g -O -o myprog.exe myprog.c -lgrx20

The stuff at the beginning is useful to add, too (look in the gcc docs for
explanations).  :)

>The questions : Why must I give the path and name of the library to use it.
>And if it's right so, what is the role of the path to the grx library in my
>DJGPP.ENV

The path tells gcc where to look *for* libraries that you instruct it to link
with the -l switch.  It doesn't instruct the linker to look *in* all those
libraries,
though - that would seriously slow it down.  The only files linked in
automatically are libc.a, libgcc.a, and crt0.o - you yourself must specify
any others that you need.  (Exception:  'gxx' automatically links the C++
libraries when run, but it is in effect just a fancy wrapper for 'gcc'.)

John

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019