Create a Subsystem
To create a subsystem, you must first create one or more
source files as you would for any other program. Subsystems can
be written in C or C++. No special file extension is required.
To compile your source files into a subsystem, use the /Rn
compiler option to select the subsystem libraries. When you use
this option, the compiler does not generate the external
references that would build an environment. The subsystem
libraries are also specified in each object file to be linked in
at link time. The default compiler option is /Re, which creates
an object with a runtime environment.
If you are creating a subsystem DLL, you must use the /Ge-
option in addition to /Rn. You can use either static linking
(/Gd-), which is the default, or dynamic linking (/Gd+).
Restrictions When You Are Using Subsystems
- When you do not use the runtime environment, you must
provide your own initialization functions, multithread
support, exception handling, and termination functions.
You
can use Win32 APIs.
- Functions in the subsystem libraries are intended for
single-thread applications only. No multithread support
is provided. If you want to use the subsystem libraries
in multithread programs, you must provide your own
protection and serialization, and your own buffering for
input and output.
- If you are creating an executable module, the envp
parameter to main is not supported. However, the argv and
argc parameters are available. See for a description of
envp under the runtime environment.
- If you need to pass parameters to a subsystem executable
module, the argv and argc command-line parameters to main
are supported. However, you cannot use the envp parameter
to main.
- The low-level I/O functions allow you to perform some
input and output operations. You are responsible for the
buffering and formatting of I/O.

Subsystems