Visual C++ 4.2 and NT 4.0 SDK (1996) under Wine: build NT 4.0 programs with cl, link and nmake
38
Visual C++ 4.2 (July 1996) and the Win32 SDK for Windows NT 4.0 (1996) in a container. Build programs for Windows NT 4.0 with the original Microsoft tools. They run under Wine on 32-bit Debian.
cl 10.20: the C and C++ compiler. C++ has templates, namespaces, exceptions with -GX and RTTI with -GR.link 4.20: the linker.nmake 1.61, with the SDK's win32.mak.lib 4.20, rc 4.00, cvtres 4.00, dumpbin 4.20, editbin 4.20, bscmake 4.10, mc 1.00, mktyplib 2.20, midl 3.00, cvpack, makehm, uuidgen.MSVCRT.DLL and MFC42.DLL, in /opt/msdev/redist.The programs you build are i386 programs marked for Windows NT 4.0. They run on Windows NT 4.0 and every later 32-bit Windows. Many also run under Wine in this image.
nmake APPVER=3.51, and avoid functions that NT 4.0 added.tenox7/nt35sdk.tenox7/nt31sdk.Go to your project folder and run nmake there:
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk nmake
--platform linux/386 stops a warning about the platform.!include <win32.mak>
all: hello.exe
hello.obj: hello.c
$(cc) $(cflags) $(cvars) hello.c
hello.exe: hello.obj
$(link) $(conflags) -out:hello.exe hello.obj $(conlibs)
$(guiflags) and $(guilibs).$(cvarsmt) with $(conlibsmt) or $(guilibsmt).$(cvarsdll) with $(conlibsdll) or $(guilibsdll). The program then needs MSVCRT.DLL. NT 4.0 has it.$(olelibs).$(rc) -r app.rc, then link app.res with the objects.$(implib) -out:my.lib a.obj b.obj runs lib.$(cflags) works for C++ too. Add -GX for exceptions.win32.mak links with -nodefaultlib, so name the C++ library yourself, before $(conlibs):
<iostream>, <string>, <vector> and the rest: libcp.lib, or libcpmt.lib with $(conlibsmt), or msvcprt.lib with $(conlibsdll).<iostream.h>: libci.lib, or libcimt.lib with $(conlibsmt), or msvcirt.lib with $(conlibsdll).cl finds these by itself.nmake APPVER=3.51 marks the program for NT 3.51.docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk cl hello.c
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk cl app.c user32.lib -link -subsystem:windows
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk cl -GX -GR app.cpp
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk cl -LD my.c -link -base:0x10000000
cl -MT -GX app.cpp -link -subsystem:windowscl -MD -GX -D_AFXDLL app.cpp -link -subsystem:windows. The program then needs MFC42.DLL and MSVCRT.DLL. Copies are in /opt/msdev/redist.-LD builds my.dll with its import library my.lib.-link -subsystem:console,3.51, or windows,3.51 for a GUI program.docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk dumpbin -headers hello.exe
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk dumpbin -imports hello.exe
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk midl app.idl
docker run --rm --platform linux/386 -v "$PWD":/src tenox7/nt40sdk wine hello.exe
docker run --rm -it --platform linux/386 -v "$PWD":/src tenox7/nt40sdk bash
cl link lib nmake rc cvtres dumpbin editbin bscmake mc mktyplib midl cvpack makehm uuidgen.wine-tool TOOL ARGS, for example wine-tool undname. It looks in the SDK first, then in Visual C++ 4.2./src, which is Z:\src for the tools. Relative paths work.Z: path. This works alone, or after an option such as -Fo/src/out/x.obj or -out:/src/x.exe./opt/mstools, with bin, include and lib./opt/msdev, with bin, include, lib, mfc/include, mfc/lib and redist.SETENV does, with the SDK first:
CPU=i386, for win32.makINCLUDE=Z:\opt\mstools\include;Z:\opt\msdev\include;Z:\opt\msdev\mfc\includeLIB=Z:\opt\mstools\lib;Z:\opt\msdev\lib;Z:\opt\msdev\mfc\lib-e, for example -e 'INCLUDE=Z:\src\inc;Z:\opt\mstools\include;Z:\opt\msdev\include'.-link -subsystem:windows. Without it, cl links a console program and looks for main. $(guiflags) in win32.mak does it.std::, and containers need their allocator written out: vector<int, allocator<int> > v;. string, vector, list, map and <iostream> work this way.rebase and editbin -rebase fail under Wine. Give a DLL its base address when you link it, with -base:.nmake fail, and docker run fails too.-it.docker build --platform linux/386 -t nt40sdk .
msdev/ must hold the bin, include, lib, mfc/include, mfc/lib and redist folders. On the Visual C++ 4.2 CD they are in MSDEV.mstools/ must hold the SDK's bin, include and lib folders, as its setup lays them out for i386: MSTOOLS\BIN\I386 with MSTOOLS\BIN\WINNT\I386, MSTOOLS\INCLUDE, and MSTOOLS\LIB\I386 with MSTOOLS\LIB\WINNT\I386. The SDK CD stores the libraries compressed (*.LI_), so expand them first.Content type
Image
Digest
sha256:61df4b8d2…
Size
546.7 MB
Last updated
1 day ago
docker pull tenox7/nt40sdk