Subject: Re: impure_ptr/Mingw and Cygwin
From: Andrew DeFaria <[email-masked]>
To: [email-masked]
Date: Mon, 25 Nov 2002 13:16:04 -0800

Peter A. Castro wrote:

> On Sun, 24 Nov 2002, Andrew DeFaria wrote:
>
>> Peter A. Castro wrote:
>>
>>> What you show below is only linking. I believe you need to 
>>> re-compile all of your source with -mno-cygwin -mwindows as well to 
>>> make the _impure_ptr references go away.
>>
>> But I did re-compile all my sources with -mno-cygwin -mwindows! Still 
>>  have the error.
>
> Suggest you run nm against all your objects and libraries and find which
> has the _impure_ptr references, then recompile just those.

But I did recompile everything already! The _impure_ptr keeps getting 
generated:

$ nm mksf.o | grep impure
         U __impure_ptr
$ rm mksf.o
$ make mksf.o
/bin/gcc -c -g -mno-cygwin -mwindows -I. -I../../include -I/usr/include 
-DCYGWIN mksf.c
$ nm mksf.o | grep impure
         U __impure_ptr
$

As you can see the _impure_ptr reference gets regenerated. But wait! 
There's more!

I can cause these _impure_ptr even with the little foo.c merely by 
including -I/usr/include on the command line. Why am I referencing 
/usr/include? Because in my larger application I need it for getopt.h. 
The mere inclusion of -I/usr/include causes_impure_ptr's to be emitted. 
So the question now is: How do I satisfy my need for getopt and still 
produce objects without _impure_ptr's?

Ah ha!

$ grep impure /usr/include/*.h
/usr/include/stdio.h:#define    stdin   (_impure_ptr->_stdin)
/usr/include/stdio.h:#define    stdout  (_impure_ptr->_stdout)
/usr/include/stdio.h:#define    stderr  (_impure_ptr->_stderr)

Hmmm... Changed options to:

/bin/gcc -c -g -mno-cygwin -I. -I../../include -I/usr/include/mingw 
-I/usr/include -DCYGWIN mksf.c
cc1: warning: changing search order for system directory 
"/usr/include/mingw"
cc1: warning:   as it has already been specified as a non-system directory

This works but why am I getting this warning?

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/