Skip to content

Suppressing the Unsupported 16 bit Application message

Vladimir Panteleev edited this page Jan 15, 2015 · 3 revisions

Attempting to compile and link an empty .d file on Windows/32 will result in the following output:

C:\> dmd empty.d
OPTLINK (R) for Win32  Release 8.00.8
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 23: No Stack
OPTLINK : Warning 134: No Start Address

Note that OPTLINK will exit with an exit code of 0, indicating success. However, the resulting .exe file will be dysfunctional, and attempting to run it will produce the following error message:

Unsupported 16-Bit Application

The program or feature "??\C:\empty.exe" cannot start or run due to incompatibity with 64-bit versions of Windows. Please contact the software vendor to ask if a 64-bit Windows compatible version is available.

Or:

C:\empty.exe

The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

This error message may pop up when DustMite attempts to compile/link an empty program, since OPTLINK indicates a successful link despite creating a broken .exe file.

To get rid of it, add -L/ENTRY:_mainCRTStartup to the compiler / build tool command-line. This will indicate a mandatory entry point (mainCRTStartup) to the linker, which will now fail with an empty program.

Note: if you get:

OPTLINK : Error 180: No Match Found for Export/ENTRY -  : _mainCRTStartup

Try -L/ENTRY:mainCRTStartup instead (remove the leading underscore from the entry point symbol name). See issue 13984.