• Please review our updated Terms and Rules here

How to make Borland C++ 5.02 compile 16-bit programs on an x64 system...

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
1,924
Location
USA
Hi Everyone,

I've developed with Borland C++ 5.02 for years, but one thing that is annoying is that the DOS linker (TLINK.EXE) was never updated to 32-bit. The result is that it compiles DOS applications with a 32-bit tool, and then links them with a 16-bit tool. This wasn't a problem at the time, but when 64-bit operating systems dropped support for running 16-bit code, it means that you can compile a DOS application on x64, but you can't link it.

Obviously the best solution would be a 32-bit version of TLINK.EXE, but after some searching for tools or something that might be able to convert a DOS application to a Win32 console application, I didn't find anything that could do something like this. If you could disassemble it and port it to win32 and recompile it that would be a great solution, but I would imagine a huge undertaking if possible at all.

I also read about someone who was trying to bring 16-bit NTVDM support to x64 systems, but it sounds like quite a bit of work to accomplish and talked about making OS changes that didn't sound comforting.

I was wondering about DOSBox or something similar, but in this case the BC5 IDE calls TLINK.EXE and expects an errorlevel returned. I found a tool called VDOS that is a single executable that starts up and autoruns an AUTOEXEC.TXT file. With this in mind I made a "stub" or placeholder for TLINK.EXE which is a 32-bit console application. It can be launched from the BC5 IDE and its job is to be the "go between". It will setup the AUTOEXEC.TXT file and launch VDOS.EXE to which calls TLINKDOS.EXE to carry out the link, and then finally it will return the errorlevel to the BC5 IDE.

The linking problem probably isn't the only problem - you also can't install BC5 on x64 because it uses a 16-bit installer, but Borland has the whole BC5 directory on the CD-ROM and you can just copy it. You could also install it on x86 and then copy the directory from that to your x64 machine. You also can't debug or run 16-bit code unless you launch VDOS and run it or debug it there.

It might work with older Borland windows based compilers as well, I'm not sure because I haven't tested it.

To make this work:

Rename the real TLINK.EXE file in the BC5\BIN directory to TLINKDOS.EXE.

Copy the TLINK.EXE file from the attached ZIP file into the BC5\BIN directory.

Obtain the VDOS.EXE from this location and also put it in the BC5\BIN directory:
http://www.vdos.info

I've include my TLINK.CPP so you can tweak it if necessary. It will automatically detect the BC5 installation path. It goes without saying that the BC5 installation path and project path should be short file name compatible.
 

Attachments

  • tlink.zip
    28.5 KB · Views: 1

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
1,924
Location
USA
I've got plenty of machines I can run it on...it was an exercise to see if I could make it work!
 

deathshadow

Veteran Member
Joined
Jan 4, 2011
Messages
1,373
Odd that DOSBox would give you an error... how about a proper virtual machine? Install something like 32 bit XP in Oracle VirtualBox where you can still run 16 bit DOS stuff in the shell window, but is new enough that the client software lets you map network shares and/or drag/drop between desktops.

Would be WAY faster than DOSBox being that it's a Virtual Machine, so things would run WAY closer to native speed.
 

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
1,924
Location
USA
An update on this - I found a really cool tool here called the MS-DOS Player that does this much easier than using vDOS:


This program has a way to make a new executable to replace the old.

To do this just do this:

cd\bc5\bin
ren tlink.exe tlinkdos.exe
msdos -ctlink.exe tlinkdos.exe

The msdos.exe (MS-DOS Player) will create a new tlink.exe that acts and feels just like its dos counterpart.
 

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
1,924
Location
USA
Yes, MS pushed out 16 bit compatibility when they pushed everyone towards 64-bix operating systems.
 
Top