X-Spam-Check-By: sourceware.org
Message-ID: <46813D13.60EE664D@dessent.net>
Date: Tue, 26 Jun 2007 09:21:39 -0700
From: Brian Dessent <brian@dessent.net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: undefined reference to `__imp___iob'
References: <C6EEDB0EB45A56439F73B1D23E39694A35C424@USORL02P702.ww007.siemens.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

"Frederich, Eric P21322" wrote:

> Are there any tips to compile compatible libraries with msys / cygwin?
> Is it even possible?
> Am I missing a gcc option?

No, it's not possible.

Cygwin libraries use the Cygwin runtime.  MinGW/MSYS libraries use the
Microsoft (MSVCRT) runtime.  These are two inherently different and
incompatible implementations of a C runtime, so you can't link a program
that uses both and expect it to work.

It is technically possible if you are very sure of what you're doing,
but this would involve making sure that all C functions are resolved to
the correct library.   For example, printf() in the MinGW code must go
to MSVCRT, printf() in the Cygwin code must go to cygwin1.dll.  The only
way I can think to do this is with LoadLibrary()/GetProcAddress() and
function pointers for everything.  It also would mean that no C library
data structures could be passed between the two, such as file
descriptors, FILE *, struct stat, etc.  It would be an extremely
inconvent way to write code, and it would be much easier and cleaner to
just compile all code as Cygwin code or all code as native (MSVCRT)
code.

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/

