This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: cygwin, g++ and boost? Do I need dll.a?


On 09 January 2008 04:57, adam99 wrote:

> After several trials with an hello world code an trying to link library, I
> realized that I can not link anything in /lib without dll.a extension
> 
> g++ -o hello -L/lib hello.cpp -llibcrypt
> this works, since
> ls /lib/libcrypt*
> /lib/libcrypt.a  /lib/libcrypt.dll.a
> 
> g++ -o hello -L/lib hello.cpp -llibbfd
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot
> find -llibbfd
> collect2: ld returned 1 exit status
> 
> fails as libbfd.dll.a does not exist;
>  ls /lib/libbfd*
> /lib/libbfd.a  /lib/libbfd.la

  Wrong reasoning.  The actual problem is that you need to remove the 'lib'
prefix when supplying a library name:

> g++ -o hello -L/lib hello.cpp -lcrypt
> g++ -o hello -L/lib hello.cpp -lbfd

  Ordinary .a files are for static linking, .dll.a files are for runtime
linking against dlls, gcc selects the right one for you by using one of the
-shared or -static flags.

> none of the libboost have dll.a file;

  Yep, they are static libraries, there is no boost DLL.  Get your -l option
right and everything should be ok.

> Could you tell me why I need dll.a files? 

  The dll.a file is what is known as an import library.  A standard .a file
has all the library functions in it, and they are physically merged into your
final program executable.  An import library doesn't have the actual functions
in it, just stubs that call at runtime to the DLL that actually implements a
library.

> Also how can I generate them for
> the boost installation under cygwin

  You don't; the boost package links statically.  (And 99% of it isn't linked
at all; most of it works just by including the headers to get the templates
and classes they define inline).

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]