This is the mail archive of the cygwin@sources.redhat.com 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]

Re: DLL naming flamefest


"Henry S. Thompson" wrote:
> 
> This sounds viable, in so far as I understand it :-)
> 
> One question -- for compiling and linking from WIN32, i.e. with VC++,
> I had _serious_ trouble in this area just last week.  I think what I
> needed to know but couldn't find out is what the equivalent of
> -Bstatic is for VC++ -- is that a coherent question?
> 

There seem to be two issues:
  1) how can you instruct VC++ to link using a static lib or using a dll
import lib?
  2) can VC++ even use cygwin statlibs or cygwin implibs?

I *think* the answer to #2 is "you can't".  So question #1 is probably
moot.  

I know that VC++ doesn't use ".dll.a" for import libs so that's a
non-issue. In fact, I believe libraries are named "<name>.lib" not
"lib<name>.a", so unless you explicitly list the full name and path of
the cygwin library you want to link, VC++ won't find them (even if it
*could* use them).  But, if you give full name and path -- then you
don't need to worry about some esoteric "search order".

Going back to question #1, suppose that there are two *native* libraries
-- foo.lib (or libfoo.lib? a static lib) and foo.a (??? a dynamic import
lib).  How do you tell VC++ to link with foo.lib vs. foo.a ?  I dunno,
but I think MS sidesteps the issue by using *Completely Different Lib
Names* for dynamic vs. static.  e.g. the static runtime is libc.lib but
the dynamic runtime implib is msvcrt.lib.

If you use completely different names for the same library, where one
variant is an implib for a dll and the other variant is a statlib, then
you don't *need* a '-Bstatic' switch. Perhaps that's MS's solution to
the problem.  We (gcc/cygwin/unix-in-general) want the same (base)name
for identical libraries, and use suffixes to distinguish implibs (so's)
from statlibs.  So, we munge our linker to understand suffixes according
to some (arbitrary) convention.

The convention we chose is: .a means statlib (but maybe implib --
backwards compatible holdover); .dll.a means implib; .dll means dll.  On
unix, .so (or .sl -- HPUX) means sharedlib. 

However, further discussions of VC++ vagaries are probably off topic for
this list.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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