delorie.com/archives/browse.cgi | search |
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 |
X-Sender: | outgoing mail@ (Unverified) |
Date: | Wed, 09 Mar 2005 18:32:09 +0100 |
To: | cygwin AT cygwin DOT com |
From: | Arend-Jan Westhoff <jpmcyafvmhsl AT spammotel DOT com> |
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 |
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 <stdio.h> 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: <http://msdn.microsoft.com/visualc/vctoolkit2003/> ) 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: <http://www.network-theory.co.uk/docs/gccintro/gccintro_65.html> <http://www.network-theory.co.uk/docs/gccintro/gccintro_16.html> <http://www.linuxquestions.org/questions/archive/9/2003/10/3/105795> <http://www.linuxlookup.com/HOWTO/GCC-HOWTO/x575.html#AEN579> <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/h tml/_core_lib_reference.asp> <http://www.cygwin.com/faq/faq_3.html#SEC103> <http://www.cygwin.com/faq/faq_3.html#SEC102> -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |