delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/26/13:31:33

X-Spam-Check-By: sourceware.org
Date: Tue, 26 Jun 2007 13:31:04 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: "Frederich, Eric P21322" <eric DOT frederich AT siemens DOT com>
cc: cygwin AT cygwin DOT com
Subject: RE: undefined reference to `__imp___iob'
In-Reply-To: <C6EEDB0EB45A56439F73B1D23E39694A35C441@USORL02P702.ww007.siemens.net>
Message-ID: <Pine.GSO.4.63.0706261328360.20185@access1.cims.nyu.edu>
References: <C6EEDB0EB45A56439F73B1D23E39694A35C424 AT USORL02P702 DOT ww007 DOT siemens DOT net> <46813D13 DOT 60EE664D AT dessent DOT net> <C6EEDB0EB45A56439F73B1D23E39694A35C441 AT USORL02P702 DOT ww007 DOT siemens DOT net>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Tue, 26 Jun 2007, Frederich, Eric P21322 wrote:

> > From: cygwin-owner AT XXXXXX DOT XXX
> > [mailto:cygwin-owner AT XXXXXX DOT XXX] On Behalf Of Brian Dessent
> > Sent: Tuesday, June 26, 2007 12:22 PM
> > To: cygwin AT XXXXXX DOT XXX

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > Subject: Re: undefined reference to `__imp___iob'
> >
> > "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
>
> Thanks for your reply.
> Does everything you say hold true even if I compile with the -mno-cygwin
> option?

Not everything, but how were we to know you were using -mno-cygwin?

> The program I was talking about linked to 4 libraries so I made a small
> main.c and just tried adding one library at a time.  I wrote a small
> program to link against a single library and it worked.  I was passing
> around FILE pointers and that worked okay too.  From main.c I did the
> fopen and fclose and wrote to the file using the msys/mingw compiled
> library.  Was I just lucky?
> When I tried adding in another library I got those errors again.
>
> Apparently I'm confused.  I thought that when I compile with -mno-cygwin
> it was the same as using msys/mingw.

It is, unless you explicitly inlcude a Cygwin header.  Please provide the
exact compiler invocation and the exact errors you get.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

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