Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Sender: outgoing mail@ (Unverified) Date: Wed, 09 Mar 2005 18:32:09 +0100 To: cygwin AT cygwin DOT com From: Arend-Jan Westhoff Subject: Re: req: using cygwin's gcc for creating static libs in msvc binary format (.a => .lib) # Re: static MSVC library? Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Message-Id: <20050309173223.505222101B7@warserver.warande.net> >Hi, > >I am opening this thread again , more than 5 years later : >@ http://sources.redhat.com/ml/cygwin/1999-09/msg00541.html [1] > >How comes is it impossible to write a STATIC lib using msvc's .LIB >format ? while .DLL are possible ? > >Or at least to transcribe from gcc's .a format ? > >Anyway if it possible or not this should be somewhere in the FAQ. > >thx > Am not an expert but have tried the following for you: Source files: hello.h: void hello(); hello.c: #include void hello() { printf("Hello World\n"); } main.c: #include "hello.h" int main() { hello(); return 0; } Building and using library using Cygwin: gcc -c hello.c ar cr hello.lib hello.o gcc -o hellolib.exe main.c hello.lib Leads to a working program. This last step using the Cygwin created library also leads to a working program when using Microsoft's VC++ 6.0. Instead of ar I have also used Microsofts lib.exe (should be available from: ) successfully. E.g. when applied on the gcc compiled hello.o file: lib hello.o creates hello.lib which can again be successfully linked with using either gcc or VC++. It looks like changing a lib.a into a lib.lib might require only a rename! (But I remember reading that debug formats differ between gcc and VC.) Some additional info: -- 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/