delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/01/23/01:22:24

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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: <4010BD8D.E671419@dessent.net>
Date: Thu, 22 Jan 2004 22:22:05 -0800
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: "Cygwin Mailing List (E-mail)" <cygwin AT cygwin DOT com>
Subject: Re: Linking VC++ apps to cygwin-based DLLs
References: <E19E2FC4AD37D04E9A8832D6BF1ADA42702B67 AT xmail DOT il DOT cgen DOT biz>
X-Spam-Report: 2.2/5.0 ---- Start SpamAssassin results * 2.5 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address * [67.160.219.187 listed in dnsbl.sorbs.net] * 0.1 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS * [67.160.219.187 listed in dnsbl.sorbs.net] * -0.4 AWL AWL: Auto-whitelist adjustment ---- End SpamAssassin results
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

Tomer Zekharya wrote:

> I want to port a certain group of libraries from UNIX to windows. I managed to compile and link it using cygwin, but the Windows applications that needs these libs are MFC based, so I can't compile them in cygwin (at least that's what I understood from searching through the web and through the cygwin mailing list).
> I tried doing the opposite: compile the UNIX code to DLLs using cygwin, and trying to link to them in VC++, but I get all kind of errors.  After compiling the DLLs as described in the "Building DLLs" section in the Cygwin manual, I get the following message when linking in VC++:
> 
> warning LNK4078: multiple ".text" sections found with different attributes (E0000020)
> 
> And my application crashes on some kind of memory fault.
> 
> Since I'm new to this world of cygwin and VC++, I don't really know if I made a mistake in the cygwin side or the VC++ side. If anyone has successfully compiled MFC based applications linking against cygwin-based DLLs, I'll be more than happy to hear how he/she did it.


THis is surely in the FAQ somewhere, which I'm sure gives a better
answer than I can.

A "Cygwin" application by definition is one that links against
cygwin1.dll.  That is, it uses the Cygwin layer to provide a POSIX
interface.  If you link against cygwin1.dll you cannot also link against
another crt (C runtime) library, because the two conflict.  So, either
you must modify your VC++ code to not use any of the VC++ libraries, or
you must modify your Cygwin code so that it doesn't link against
cygwin1.dll.  The latter is possible with the "-mno-cygwin" flag to gcc,
which turns it into mingw.  Objects compiled that way will have no
dependance on cygwin1.dll, but they will also have no support for the
POSIX compatibility that Cygwin provides.  So, you can't have your cake
and eat it too.  If you want the functionality that Cygwin provides, you
must not use any other crt.

Brian

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