delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/09/22:49:14

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <6.1.2.0.0.20050309193453.020e1528@imap.myrealbox.com>
X-Sender: tprince AT imap DOT myrealbox DOT com
Date: Wed, 09 Mar 2005 19:48:58 -0800
To: cygwin AT cygwin DOT com, cygwin AT cygwin DOT com
From: Tim Prince <tprince AT computer DOT org>
Subject: Re: req: using cygwin's gcc for creating static libs in msvc binary format (.a => .lib) # Re: static MSVC library?
In-Reply-To: <20050309200112.GA17199@gully.bosbc.com>
References: <20050309173223 DOT 505222101B7 AT warserver DOT warande DOT net> <20050309173442 DOT GB16830 AT gully DOT bosbc DOT com> <422F4DBA DOT 7020501 AT buddydog DOT org> <20050309200112 DOT GA17199 AT gully DOT bosbc DOT com>
Mime-Version: 1.0
X-IsSubscribed: yes

At 12:01 PM 3/9/2005, Christopher Faylor wrote:

>A foo.lib can be used interchangeably with a libfoo.a file.  Except
>for the well-documented and frequently repeated problems with C++
>name mangling, and the even more repeated problems with mixing
>the cygwin and msvcrt runtime libraries, there should be no problems
>with using a .lib file on the gcc command line or a .a file on the
>"cl" command line.
>
>In fact, I just tried it.  I created two MSVC object files, put them
>in a .lib, and linked them with a program that I compiled using
>gcc -mno-cygwin.
>
>Then I put the same two files in a ".a" and linked them using "cl".  You
>will have to play around with the right libraries required to satisfy
>things that mingw adds to an object file if you want to use msdev for
>linking but this is not an insurmountable problem.
>
>Getting this working with object files compiled without -mno-cygwin
>would be tricky (and maybe even not possible) but it's certainly
>possible to use msvc created .lib files with gcc and gcc/ar created .a
>files with msvc.

When cygwin is used as a build environment for plain Windows compilers 
(e.g. CL, IFORT), it insists on making libraries with its own ar 
tool.  I've found it quite difficult to persuade it to use lib.  Maybe 
because the Makefile wants to use the alias AR for lib, and we run afoul of 
case insensitivity.  ar works fine for 32-bit builds.  link doesn't see 
64-bit objects in a library built by ar, because the /machine tag isn't set.
Anyway, it's hard to imagine anyone claiming .a files and ar don't work for 
32-bit builds with non-cygwin compilers.  Windows link has more complaints 
about the naming of .o files (which still work) than about the naming of 
..a.  Microsoft people say they hate seeing people use cygwin, but not 
enough to forbid people using Windows for programs which require cygwin tools.
BTW, I want to thank whoever made it so that cygwin runs right out of setup 
now on the 64-bit Windows 180-day trial version.  No more editing of 
cygwin.bat.


Tim Prince 


--
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/

- Raw text -


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