Compiler and Linker Options

Sections in this Topic:

Configurations for Creating Applications and DLLs

Two configurations for creating applications and DLLs are generated in Visual Studio when you create a project using one of the eRTOS templates:

x64

Environment Variables Used in Project Settings

eRTOS uses the following environment variables in its project settings:

Category Environment Variable
eRTOS SDK $(eRTOSSDKDir1)
eRTOS Runtime $(eRTOSDir)
eRTOS Custom Macro

$(eRTOSPlatform)

This is used to find the correct library directory for projects. This custom macro requires two property files, which are installed with the eRTOS SDK:

  • eRTOS.cpp.x64.user.props

Compiler and Linker Options for Application Projects

The tables below list the Process compiler and linker options that differ from the default Windows console application options.

Compiler Options

General
Option eRTOSDebug eRTOSRelease

Additional Include Directories

$(ERTOSSDKDIR )include;%+ inherit

$(ERTOSSDKDIR )include;%+ inherit

Debug Information Format

Program Database (/Zi)

Program Database (/Zi)

Optimization
Option eRTOSDebug eRTOSRelease

Optimization

Disabled (/Od)

Enabled (/Ox)

Whole Program Optimization

No

No

Enable Intrinsic Functions

No

No

Preprocessor
Option eRTOSDebug eRTOSRelease

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.

Code Generation
Option eRTOSDebug eRTOSRelease

Enable Minimal Rebuild

No (/Gm-)

No (/Gm-)

Enable C++ Exceptions

Yes (/EHsc)

Yes (/EHsc)

Basic Runtime Checks

Default

Default

Runtime Library

Multi-threaded Debug (/MTd)

Multi-threaded (/MT)

Buffer Security Check

No (/GS-)

No (/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.

Linker Options

General
Option eRTOSDebug eRTOSRelease

Additional Library Directories

$(ERTOSSDKDIR )lib\$(ERTOSPlatform);% + inherit

$(ERTOSSDKDIR )lib\$(ERTOSPlatform);% + inherit

Input
Option eRTOSDebug eRTOSRelease

Additional Dependencies

startupCRT.lib;libcmtd.lib; libcpmtd.lib;libvcruntimed.lib; libucrtd.lib;rtkrnl.lib or startup.lib;rtkrnl.lib;

Note: startupCRT.lib and libcmtd.lib are dependent on the C Runtime. libcpmtd.lib only appears in C++ projects.

startupCRT.lib;libcmt.lib; libcpmt.lib;libvcruntime .lib;libucrt.lib;rtkrnl.lib or startup.lib;rtkrnl.lib;

Note: startupCRT.lib and libcmt.lib are dependent on the C Runtime. libcpmt.lib only appears in C++ projects.

Ignore All Default Libraries

Yes (/NODEFAULTLIB)

Yes (/NODEFAULTLIB)

Manifest File
Option eRTOSDebug eRTOSRelease

Generate Manifest

No (/MANIFEST:NO)

No (/MANIFEST:NO)

Enable User Account Control (UAC)

No (/MANIFESTUAC:NO)

No (/MANIFESTUAC:NO)

Debugging
Option eRTOSDebug eRTOSRelease

Generate Debug Info

Yes (/DEBUG)

Yes (/DEBUG)

System
Option eRTOSDebug eRTOSRelease

kernel

Native (/SUBSYSTEM:NATIVE)

Native (/SUBSYSTEM:NATIVE)

Driver

Driver (/Driver)

Driver (/Driver)

Advanced
Option eRTOSDebug eRTOSRelease

Entry Point

_RtapiProcessEntry or_RtapiProcessEntryCRT

_RtapiProcessEntry or_RtapiProcessEntryCRT

Data Execution Prevention (DEP)

Yes (/NXCOMPAT)

Yes (/NXCOMPAT)

Target Machine

MachineX64 (/MACHINE:X64)

MachineX64 (/MACHINE:X64)

Compiler and Linker Options for DLL Projects

The tables below list the process compiler and linker options that differ from the default Windows console application options.

Compiler Options

General
Option eRTOSDebug eRTOSRelease

Additional Include Directories

$(ERTOSSDKDIR )\include + Inherit

$(ERTOSSDKDIR )\include + Inherit

Debug Information Format

Program Database (/Zi)

Program Database (/Zi)

Support Just My Code Debugging

No

No

Warning Level

Level3 (/W3)

Level3 (/W3)

Optimization
Option eRTOSDebug eRTOSRelease

Optimization

Disabled (/Od)

Enabled (/Ox)

Whole Program Optimization

No

No

Enable Intrinsic Functions

No

No

Preprocessor
Option eRTOSDebug eRTOSRelease

Preprocessor Defines

_AMD64_; UNDER_RTSS; _DEBUG; + inherit

_AMD64_; UNDER_RTSS; NDEBUG; + inherit

Code Generation
Option eRTOSDebug eRTOSRelease

Enable Minimal Rebuild

No (/Gm-)

No (/Gm-)

Enable C++ Exceptions

Yes (/EHsc)

Yes (/EHsc)

Basic Runtime Checks

Default

Default

Runtime Library

Multi-threaded Debug (/MTd)

Multi-threaded (/MT)

Buffer Security Check

No (/GS-)

No (/GS-)

Floating Point Model

Precise (/fp:precise)

Precise (/fp:precise)

Linker Options

Input
Option eRTOSDebug eRTOSRelease

Additional Dependencies

startupDllCrt.lib;libcmtd.lib; libcpmtd.lib;rtkrnl.lib or startup.lib;rtkrnl.lib;

startupDllCrt.lib;libcmt.lib; libcpmt.lib;libvcruntime .lib;libucrt.lib;rtkrnl.lib or startup.lib;rtkrnl.lib;

Ignore All Default Libraries

Yes (/NODEFAULTLIB)

Yes (/NODEFAULTLIB)

Manifest File
Option eRTOSDebug eRTOSRelease

Generate Manifest

No (/MANIFEST:NO)

No (/MANIFEST:NO)

Enable User Account Control (UAC)

No (/MANIFESTUAC:NO)

No (/MANIFESTUAC:NO)

Debugging
Option eRTOSDebug eRTOSRelease

Generate Debug Info

Yes (/DEBUG)

Yes (/DEBUG)

System
Option eRTOSDebug eRTOSRelease

kernel

Native (/SUBSYSTEM:NATIVE)

Native (/SUBSYSTEM:NATIVE)

Driver

Driver (/Driver)

Driver (/Driver)

Advanced
Option eRTOSDebug eRTOSRelease

Entry Point

_RtapiDllEntry or _RtapiDllEntryCRT

_RtapiDllEntry or_RtapiDllEntryCRT

Target Machine

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 Process configurations is:

Configuration Stack Size

eRTOSRelease

Default (12 pages, 65536 bytes)

eRTOSDebug with C/C++ Runtime support enabled

32 pages, 131072 bytes

eRTOSDebug without C/C++ Runtime support

Default (12 pages, 65536 bytes)

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 12 pages.

Important: The stack does not grow in a process. As such, you must be aware of the amount of space you need on the Stack. A Green Screen can result if the Stack size is too small.

To set the Stack size:

To set this option in the Visual Studio environment:

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 MSDN Visual C++ /STACK Linker Option description available from the http://msdn.microsoft.com/ webpage.