Compiler and Linker Options
Sections in this Topic:
- Configurations for Creating Applications and DLLs
- Environment Variables Used in Project Settings
- Compiler and Linker Options for Application Projects
- Compiler and Linker Options for DLL Projects
- Stack Size
Configurations for Creating Applications and DLLs
x64
- RTSSDebug – Real-time application or RTDLL that has debug flags enabled
- RTSSRelease – Optimized Real-time application or RTDLL without any additional debug information
- Debug – Windows 64-bit application or RTDLL linked to wRTOS that has debug flags enabled
- Release – Windows 64-bit application or RTDLL linked to wRTOS
For instructions on manually building a 32-bit application, see Building a 32-bit User Space Application.
Environment Variables Used in Project Settings
wRTOS uses the following environment variables in its project settings:
| Category | Environment Variable |
|---|---|
|
wRTOS SDK |
$(wRTOSSDKDir<MAJORVERSION>)
Where
|
|
wRTOS Runtime |
|
|
Tools |
|
|
wRTOS Custom Macro |
This is used to find the correct library directory for projects. This custom macro requires two property files, which are installed with the wRTOS SDK:
If you are creating an RTSS application from a Windows console, you must change this custom macro to $(Processarchitecture) |
Compiler and Linker Options for Application Projects
The RTSS compiler and linker options listed below differ from the default Windows console application and wRTOS product options.
Compiler Options
General
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Additional Include Directories |
$(wRTOSSDKDir <MAJORVERSION>)include;%+ inherit |
$(wRTOSSDKDir <MAJORVERSION>)include;%+ inherit |
$(wRTOSSDKDir <MAJORVERSION>)include;%+ inherit |
$(wRTOSSDKDir <MAJORVERSION>)include;%+ inherit |
|
Debug Information Format |
Program Database (/Zi) |
Program Database (/Zi) |
Program Database (/Zi) |
Program Database (/Zi) |
|
SDL Checks |
No (/sdl-) |
No (/sdl-) |
No (/sdl-) |
Yes (/sdl) |
Optimization
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Optimization |
Disabled (/Od) |
Enabled (/Ox) |
Disabled (/Od) |
Maximize Speed (/02) |
|
Whole Program Optimization |
No |
No |
No |
Yes (/GL) |
Preprocessor
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Preprocessor Defines |
_AMD64_;
UNDER_RTSS;
_DEBUG;+ inherit Note: Include the UNDER_RTSS_UNSUPPORTED_CRT_APIS define to see what C Runtime functions have been deprecated. |
_AMD64_;
UNDER_RTSS;
NDEBUG;+ inherit Note: Include the UNDER_RTSS_UNSUPPORTED_CRT_APIS define to see what C Runtime functions have been deprecated. |
-UNICODE;UNICODE; _DEBUG% + inherit Note: Unicode or MultiByte, depending on what was selected for Supported String Convention in the template. |
_UNICODE;UNICODE;% + inherit Note: Unicode or MultiByte, depending on what was selected for Supported String Convention in the template. |
Code Generation
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Enable Minimal Rebuild |
No (/Gm-) |
No (/Gm-) |
No (/Gm-) |
No (/Gm-) |
|
Enable C++ Exceptions |
Yes (/EHsc) |
Yes (/EHsc) |
Yes (/EHsc) |
Yes (/EHsc) |
|
Basic Runtime Checks |
Default |
Default |
Both (/RTC1, equiv. to /RTCsu) (/RTC1) |
Default |
|
Runtime Library |
Multi-threaded Debug (/MTd) |
Multi-threaded (/MT) |
Multi-threaded Debug (/MTd) |
Multi-threaded (/MT) |
|
Buffer Security Check |
No (/GS-) |
No (/GS-) |
No (/GS-) |
Yes (/GS-) |
|
Floating Point Model |
Precise (/fp:precise) Note: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected. |
Precise (/fp:precise) Note: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected. |
Precise (/fp:precise) Note: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected. |
Precise (/fp:precise) Note: The /fp:precise compiler flag may affect certain API determinism. For example, functions such as log or sin will be affected. |
Linker Options
General
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Enable Incremental Linking |
No (/INCREMENTAL:NO) |
No (/INCREMENTAL:NO) |
Yes (/INCREMENTAL) |
|
|
Additional Library Directories |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
Input
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Additional Dependencies |
startupCRT.lib;libcmtd.lib;libcpmtd.lib;libucrtd.lib; libvcruntimed.lib;wRTOS_rtss.lib Note: startupCRT.lib, libcmtd.lib, libcpmtd.lib, libucrtd.lib and libvcruntimed.lib are dependent on the C Runtime, only appears in C++ projects |
startupCRT.lib;libcmt.lib;libcpmt.lib;libucrt.lib; libvcruntime.lib;wRTOS_rtss.lib Note: startupCRT.lib, libcmt.lib, libcpmt.lib, libucrt.lib and libvcruntime.lib are dependent on the C Runtime, only appears in C++ projects. |
rtapi.lib + inherit |
rtapi.lib + inherit |
|
Ignore All Default Libraries |
Yes (/NODEFAULTLIB) |
Yes (/NODEFAULTLIB) |
No |
No |
Manifest File
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Generate Manifest |
No (/MANIFEST:NO) |
No (/MANIFEST:NO) |
Yes (/MANIFEST) |
Yes (/MANIFEST) |
|
Enable User Account Control (UAC) |
No (/MANIFESTUAC:NO) |
No (/MANIFESTUAC:NO) |
Yes (/MANIFESTUAC:) |
Yes (/MANIFESTUAC:) |
Debugging
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Generate Debug Info |
Yes (/DEBUG) |
Yes (/DEBUG) |
Yes (/DEBUG) |
Yes (/DEBUG) |
System
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Subsystem |
Native (/SUBSYSTEM: NATIVE) |
Native (/SUBSYSTEM: NATIVE) |
Console (/SUBSYSTEM: CONSOLE) |
Console (/SUBSYSTEM: CONSOLE) |
|
Driver |
Driver (/Driver) |
Driver (/Driver) |
Not Set |
Not Set |
Advanced
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Entry Point |
_RtapiProcessEntry or_RtapiProcessEntryCRT |
_RtapiProcessEntry or_RtapiProcessEntryCRT |
|
|
|
Randomized Base Address |
|
|
Yes (/DYNAMICBASE) |
Yes (/DYNAMICBASE) |
|
Data Execution Prevention (DEP) |
Yes (/NXCOMPAT) |
Yes (/NXCOMPAT) |
Yes (/NXCOMPAT) |
Yes (/NXCOMPAT) |
|
Target Machine |
MachineX64 (/MACHINE:X64) |
MachineX64 (/MACHINE:X64) |
MachineX64 (/MACHINE:X64) |
MachineX64 (/MACHINE:X64) |
Compiler and Linker Options for DLL Projects
The tables below list the RTSS compiler and linker options that differ from the default Windows console application options and wRTOS product compiler and linker options.
Compiler Options
General
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Additional Include Directories |
$(wRTOSSDKDir <MAJORVERSION>)\include + Inherit |
$(wRTOSSDKDir <MAJORVERSION>)\include + Inherit |
$(wRTOSSDKDir <MAJORVERSION>)\include + Inherit |
$(wRTOSSDKDir <MAJORVERSION>)\include + Inherit |
|
Debug Information Format |
Program Database (/Zi) |
Program Database (/Zi) |
Program Database (/Zi) |
|
|
SDL Checks |
No (/sdl-) |
No (/sdl-) |
No (/sdl-) |
Yes (/sdl) |
|
Warning Level |
Level3 (/W3) |
Level3 (/W3) |
Level1 (/W1) |
Level1 (/W1) |
Optimization
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Optimization |
Disabled (/Od) |
Enabled (/Ox) |
Disabled (/Od) |
Maximum Speed (/O2) |
|
Whole Program Optimization |
No |
No |
No |
No |
Preprocessor
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Preprocessor Defines |
_AMD64_; UNDER_RTSS; _DEBUG; wRTOS_EXPORTS; + inherit Note: wRTOS_EXPORTS is name dependent. |
_AMD64_; UNDER_RTSS; NDEBUG; wRTOS_EXPORTS; + inherit Note: wRTOS_EXPORTS is name dependent. |
DLL64_EXPORTS; + inherit Note: DLL64_EXPORTS is name dependent. |
DLL64_EXPORTS; + inherit Note: DLL64_EXPORTS is name dependent. |
Code Generation
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Enable Minimal Rebuild |
No (/Gm-) |
No (/Gm-) |
Yes (/Gm-) |
No (/Gm-) |
|
Enable C++ Exceptions |
Yes (/EHsc) |
Yes (/EHsc) |
Yes (/EHsc) |
Yes (/EHsc) |
|
Basic Runtime Checks |
Default |
Default |
Both (/RTC1, equiv. to /RTCsu) (/RTC1) |
Default |
|
Runtime Library |
Multi-threaded Debug (/MTd) |
Multi-threaded (/MT) |
Multi-threaded Debug (/MTd) |
Multi-threaded (/MT) |
|
Buffer Security Check |
Yes (/GS) |
Yes (/GS) |
Yes (/GS) |
Yes (/GS) |
|
Floating Point Model |
Precise (/fp:precise) |
Precise (/fp:precise) |
Precise (/fp:precise) |
Precise (/fp:precise) |
Linker Options
Input
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Enable Incremental Linking |
No (/INCREMENTAL:NO) |
No (/INCREMENTAL:NO) |
Yes (/INCREMENTAL) |
|
|
Additional Library Directories |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
$(wRTOSSDKDir <MAJORVERSION>)lib\$(wRTOSPlatform);% + inherit |
|
Additional Dependencies |
startupDllCrt.lib;libcmtd.lib;libcpmtd.lib;libucrtd.lib;libvcruntimed.lib;wRTOS_rtss.lib |
startupDllCrt.lib;libcmt.lib;libcpmt.lib;libucrt.lib;libvcruntime.lib;wRTOS_rtss.lib |
rtapi.lib + inherit |
rtapi.lib + inherit |
|
Ignore All Default Libraries |
Yes (/NODEFAULTLIB) |
Yes (/NODEFAULTLIB) |
No |
No |
Manifest File
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Generate Manifest |
No (/MANIFEST:NO) |
No (/MANIFEST:NO) |
Yes (/MANIFEST) |
Yes (/MANIFEST) |
|
Enable User Account Control (UAC) |
No (/MANIFESTUAC:NO) |
Yes (/MANIFESTUAC:) |
Yes (/MANIFESTUAC:) |
Yes (/MANIFESTUAC:) |
Debugging
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Generate Debug Info |
Yes (/DEBUG) |
Yes (/DEBUG) |
Yes (/DEBUG) |
Yes (/DEBUG) |
System
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
SubSystem |
Native (/SUBSYSTEM: NATIVE) |
Native (/SUBSYSTEM: NATIVE) |
Console (/SUBSYSTEM: CONSOLE) |
Console (/SUBSYSTEM: CONSOLE) |
|
Driver |
Driver (/Driver) |
Driver (/Driver) |
Not Set |
Not Set |
Advanced
| Option | RTSSDebug | RTSSRelease | Debug | Release |
|---|---|---|---|---|
|
Entry Point |
_RtapiDllEntry or _RtapiDllEntryCRT |
_RtapiDllEntry or_RtapiDllEntryCRT |
|
|
|
Randomized Base Address |
|
|
Yes (/DYNAMICBASE) |
Yes (/DYNAMICBASE) |
|
Data Execution Prevention (DEP) |
Yes (/NXCOMPAT) |
Yes (/NXCOMPAT) |
Yes (/NXCOMPAT) |
Yes (/NXCOMPAT) |
|
Target Machine |
MachineX64 (/MACHINE:X64) |
MachineX64 (/MACHINE:X64) |
MachineX64 (/MACHINE:X64) |
MachineX64 (/MACHINE:X64) |
Stack Size
The /STACK linker option is available to set the size of the main thread's stack in bytes. The default stack size for RTSS configurations is:
| Configuration | Stack Size |
|---|---|
|
RTSSRelease |
Default (8 pages, 32768 bytes) On Windows 11 machines with AMX enabled, the default stack size is 12 pages. |
|
RTSSDebug with C/C++ Runtime support enabled |
32 pages, 131072 bytes |
|
RTSSDebug without C/C++ Runtime support |
Default (8 pages, 32768 bytes) On Windows 11 machines with AMX enabled, the default stack size is 12 pages. |
Note: The above values are for the stack size for the main thread only. All subsequent thread's stacks are created based on the size set when calling CreateThread. If no size is set in CreateThread, the default is 8 pages.
IMPORTANT: The stack does not grow in RTSS. As such, you must know how much space you need on the Stack. A Blue Screen can result if the Stack size is too small.
To set the Stack size:
To set this option in the Visual Studio environment:
- Right-click project name and select Properties from the pull-down menu
- Expand the Linker option under Configuration Properties
- Click the System property page
- Modify Stack Reserve Size and Stack Commit Size
Note: Although a value must be entered for Stack Reserve Size, it is not used. Only the value in the Commit box is used.
For more information, see the Microsoft documentation on /STACK (Stack allocations).
Related Topics: