Subject: Re: included headers with mno-cygwin
From: "Paul Garceau" <[email-masked]>
To: [email-masked]
Date: Mon, 13 Nov 2000 20:30:57 -0800

Hi folks,

On 14 Nov 2000, at 1:16, the Illustrious Tilman Utz wrote:

> Hello all,
> 
> I'm trying to compile a library for C++ with gcc with mno-cygwin
> option (I already posted on that some time ago). At the moment, I
> have the cygwin1.dll-version 1.1.5. Before using the flag, I did
> as described in Mumits mno-cygwin howto, installed the aditional
> mingw stuff and passed the right options to the compiler and
> linker (at least I think, I did so...). I'm now at the stage that
> the makefile (supplied with the lib) runs without errormessages,
> but the 'make check' failed after a while. More detailed: during
> making, some executables are generated, which are ran during make
> check, and one of them (the others probably too) causes a (the
> errormessage is in German, I think it's a) stack error in the
> module KERNEL32.DLL at ...
> 
> What I discovered until now:
> - I passed the -H option to the compiler to see what headers are
> included. The output file is about 1.57 MByte large and I
> couldn't read everything so far, but at a first glance, I saw the
> following headers repeatedly being included:
> 
> 
> /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-4/../../../../include/g++-
> 3/iostream.h

	Here are the most immediate problems I can see:

	/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-4, unless there is a 
symlink of some sort somewhere else, is no longer referenced by 
Cygwin.  I base this statement on the observation that the 
latest installation (setup.exe from sources.redhat.com) does not 
create any such directory/folder on a fresh install.

	Not sure if this is because of original version you are using 
or not.  However, you might want to delete your cygwin 
directory/folder and start with a fresh install.  I don't know 
if the latest setup handles this...DJ?

> 
> 
> /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-4/../../../../include/g++-
> 3/streambuf.h
> 
> 
> /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-4/../../../../include/g++-
> 3/libio.h
> 
> ..and I think they aren't mingw headers, are they?

	You are correct, they are not mingw headers and the libraries 
being referenced actually expect g++ v3 to be installed. (g++ v3 
is not part of crtdll mingw distribution included with Cygwin)

	The following command using the latest version of cygwin:

		c++ foo.cpp -ofoo.exe -mno-cygwin

	works using the following source:

#include <windows.h>
#include <iostream.h>

int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int 
nShow)
{
        MessageBox (NULL, "Hello, Windows!", "Hello", MB_OK);
        return 0;
}

---

	It doesn't work for the following source:

#include <windows.h>
#include <iostream.h>

int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int 
nShow)
{
		 cout << "Hellowin for C++";
        MessageBox (NULL, "Hello, Windows!", "Hello", MB_OK);
        return 0;
}

	In the first case above, the executable has no reference to 
cygwin1.dll when viewed using "quikview" (standard for NT4, 
optional for Win98).

	Removing -mno-cygwin will automatically invoke the Cygwin g++ 
library.

> So i think
> they shouldn't be included. The following seems to me as a
> logical consequence of the above:
> 
> - objdump -p executable-name | grep "DLL Name" produced the
> following result:
>                      DLL Name: KERNEL32.dll
>                      DLL Name: cygwin1.dll
>                      DLL Name: crtdll.dll
>       or is ist ok, that it uses cygwin _and_ crtdll?

	Yes, that is the only way it works for -mno-cygwin 
compile/linking.

> 
> So, what I'd like to ask: If the above headers aren't mingw,
> where may I get the corresponding mingw headers?

	Afaik, the the .dlls you reference are provided by MS as part 
of any MS OS distribution and, individually, need to be 
referencable by the linker.

> How can I make
> the makefile not include cygwin<1.dll> headers?

	As you did earlier, simply compile with -mno-cygwin.  
crtdll.dll and Kernel32.dll are required for win32api based 
builds using either cygwin or mingw.

	If you need to build a mingw c++ app then,  for now, you would 
probably be better off downloading mingw-msvcrt distribution and 
then adding the g++ libs (g++-v3, as a general behavioural rule, 
works fine for mingw after you build and install the g++-v3 
libs).

	Peace,

		Paul G.

Nothing real can be threatened.
    Nothing unreal exists.

--
Want to unsubscribe from this list?
Send a message to [email-masked]