Compiler Options

New command-line switches:

This release contains a file called specs. The file defines some GCC switches, if you use the new GCC options -Zwin32 and -Zrsx32. To use C runtime DLLs you should use the option Zcrtdll=crtrsxnt

Type of executables:

-Zwin32:
Builds a GUI or Console Win32 program. The program is linked with the default Win32 libraries kernel32.a, user32.a and gdi32.a. The program should run under all Win32 environments. Win32s for Win31 only supports GUI programs and has a limited Win32-API, but the console programs (like gcc) can run inside the IDE rsxide.
-Zrsx32:
Builds a bound Win32 program. These programs can run under Win32 console and under a 32-bit DPMI host (DOS boxes, QDPMI, 386MAX) with the RSX DOS-extender. RSXWIN 3.1 can run these executables in a window of Win 3.x environments (also WINOS/2).

Running makefiles:

It is really easy to modify makefiles for emx tools to create Win32 applications. For the most GNU tools you must only redefine the “CC” macro.

	$(CC) = gcc -Zwin32

or

	$(CC) = gcc -Zrsx32

GCC command-line switches (in examples):

-Zwin32 Creates Win32 executable
-Zrsx32 Creates bound executable (Win32 console / 32-bit DOS)
-Zsys Use system library instead rsxnt.dll
-Zmt Creates a multithreaded application
-Zdll Creates a Dynamic Link Library (DLL)
-Zno-rte Executable without C-runtime
-Zdll-so Stand-alone DLL
-Zcrtdll=crtrsxnt Uses the dynamic C runtime DLL
-mprobe Enables stack probes to commit the stack
-m486 Align for 486 CPU and higher
-Wall Enables all warnings
-c compile only, does not link
-g Includes symbolic debugging information (GDB)
-s Strips symbols from executable
-O Enables optimizer
-pipe Use pipes rather than temporary files for communication between the various stages of compilation.
-v Prints compile commands

GCC compiler stages:

Pre-processor:

The option -Zwin32 defines the symbol __WIN32__ and __RSXNT__.

The option -Zrsx32 defines the symbol __RSX32__ and __RSXNT__.

The option -Zcrtrsxnt=crtrsxnt defines the symbol __CRTRSXNT__.

The option -Zdll defines the symbol __DLL__

Compiler:

The new options set the cc1 option -mprobe to enable stack probes.

Linker:

The options -Zwin32 and -Zrsx32 links the program at the Win32 image base address 0x400000. Some emx C-library functions are replaced with the libraries win32crt.a, win32dll.a, wthreads.a, c_dllnrt.a and winmain.a.

The option -Zwin32 also links the libraries kernel32.a, user32.a and gdi32.a to the program.

Zcrtdll=rsxntcs will link the C runtime library to the application.

Ntbind:

-Zwin32 -s (Win32 release):

Ntbind uses a short DOS stub, that prints: 'This Win32 program cannot run under DOS'.

-Zwin32 (Win32 debug):

Ntbind uses a emx compatible DOS stub, that allows to use GDB. Unfortunately, RSX can run this program.

-Zrsx32 (bound mode):

Ntbind uses the DOS stub 'dosstub.rsx' that contains a valid emx header. RSX and RSXWIN also can run this program.

Supported targets:

Possible applications and supported environments:

GCC TXTADDR COMMENT NT 95 32S RSX -WIN EMX OS2
-Zwin32 0x410000 Win32 GUI, Console x x x - - - -
-Zrsx32 0x410000 text-applications x x (x)1 x x - -
- 0x10000 text-applications - - - x x x x
- 0x10000 PM OS/2 app - - - - - - x

Notes:

1: Inside RSXIDE program

Column Description
NT WinNT 3.5x
95 Win95
32S Win3.1 + Win32s 1.30
RSX DOS-box or DOS with DPMI and rsx extender
-WIN Win 3.1/95 and rsxwin extender
EMX DOS and emx extender
OS2 OS/2 2.x / 3.x