Subject: About using mingw32 with RSXIDE and PFE32
From: [email-masked] (Sjoerd Bakker)

22 Oct 1998 03:31:11 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: [email-masked]

I know that using an IDE for developing gnu-win32 code is not a very
populair idea with some of you Unix(-alike)-people. So I hope you will just
delete this message without getting angry.

For those of you who *are* interested: I'm currently using mingw32 (JJH's
version) with RSXNT's IDE which is included in rsxnt141.zip (2.2 Mb) and
PFE32 (freeware Programmer's File Editor) as an editor. This is a very
workable IDE-environment for developing and porting under Windows. I have
made some adaptions:

1. I use Microsofts resource compiler RC instead of windres. RC is included
in the platform base SDK and downloadable from Microsoft. The pathname of
RC's include directory shoud be specified with double backslashes in
RSXIDES's .ini-file, e.g. RC=rc /r /i C:\\MINGW32\\INCLUDE %f.
 
2. For linking .res - and .o files I use rsrc.exe, also from RSXNT. RSXIDE
is automatically configured to work with rsrc.

3. I've hex-edited RSXIDE, so that it now compiles with either no (RSXNT-)
standard-options for console programs, or -mwindows for 'real' windows
coding. This is an easy edit... just replacing -Zwin32 with zeros and
-Zcrtdll=crtrsxnt with -mwindows<space><00>. Now the first two options of
"Use Runtime libraries" from the menu Opions::TargetSwitches::General will
generate no options and -mwindows in the makefile respectively.
 
4. RSXIDE is configured to work with a number of editors and PFE32 is one
of them. By double-clicking on gcc-output you can make PFE go to the exact
line in which the error is located. For cooperation between RSXIDE and
PFE32 when invoking PFE to edit header-files, the (mingw32-) environment
variables that point to include-directories should be changed from, for
instance, c:\mingw32\include to \mingw32\include. Apparently RSXNT sees
colons as information-seperators, and it treats the first item of a line as
the pathname and the second as the line-number to which PFE should go.
Therefore, output like c:\mingw32\include\glu.h:23:warning:etc. will not be
interpreted correctly by RSXIDE. The other files of a project will normally
be in the 'current directory', so RSXIDE doesn't use their full pathname. 

5. I wrote a little program to remove duplicate backslashes in pathnames
that cc1plus (cc1 does not do this) outputs to stderr. PFE can't handle
these 'C-style' pathnames. For C++ compiling I call this program instead of
gcc itself and it then calls gcc. Unfortunately a direct _popen doesn't
seem to work when calling gcc (although it does work well with many other
programs), so I use a temporary file instead. I copied this method from
D.J. Delorie's redir.c.

The following source code of slash.c works, but it does no error checking.
It is also not very safe from other viewpoints (e.g. no fixed location for
the temporary file which sometimes results in failed deletion) but I won't
go into that. I've included this code mainly to show how a slash-filter
*could* be written ;)

I hope that these suggestions for use of and changes to the 'package'
mingw32, RSXIDE and PFE32 can be of use to someone. I'm not 'supporting'
these adaptions and I'm also not liable for their consequences or
correctness: use them at your own risk. If you want to react and want a
quick(er) reply, please also send a copy to my e-mail address because I'm
not subscribed to this mailinglist. 

Sjoerd Bakker
[email-masked]

-------------------------- slash.c -------------------------

#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
char *temp_name = "slash.tmp";
int gcc, c, prev_c = 'a';

close (2); 
/* close stderr */

open (temp_name, O_RDWR | O_CREAT | O_TRUNC, 0666);
/* temp-file should be assigned handle 2 */

gcc = spawnvp (P_WAIT, "gcc", argv);

lseek (2, 0L, SEEK_SET);
while (read(2, &c, 1) > 0)
  { c &= 0xFF;
    if (! (c == '\\' && prev_c == '\\'))
        putchar (c);
    prev_c = c;
  }

close (2);
remove (temp_name);

return gcc;
}

-----------------------------------------------------------   

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".