Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What modern C compiler can I use to build this 1992 MS-DOS program?

I was given the source code to modify an MS-DOS program built back in 1992. I have the EXE file and it runs fine, but I need to modify the source code. The source code needs the below headers to compile.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <dos.h>
#include <dir.h>
#include <alloc.h>
#include <ctype.h>
#include <string.h>
#include <mem.h>
#include <values.h>

Does anyone know what was used and are there any modern compilers that can handle this? I tried with Visual Studio 2010 and GCC "out of the box", but it fails because some headers are missing (dir.h, alloc.h, mem.h, values.h)

like image 559
user785179 Avatar asked Nov 30 '22 16:11

user785179


2 Answers

It might be more interesting to ask what what function declarations, type declarations, global variable declarations and macros it needs to have. The particular arrangement of those things into headers isn't very interesting as long as they are all there.

So comment out the offending #includes and let the compiler complain about the bits it is missing. Then you know what you're looking for.

like image 186
dmckee --- ex-moderator kitten Avatar answered Dec 05 '22 03:12

dmckee --- ex-moderator kitten


You could try the Open Watcom compiler, which is one of the few relatively up-to-date compilers that builds 16-bit DOS executables. Other than finding an old MS or Borland compiler (or whatever was originally used), that's probably the easiest route.

If you want to rebuild for a different platform instead of rebuilding for DOS again, you'll likely have to make a lot of changes to the program itself. That may be worthwhile, but may be a lot of work and have a lot of surprise headaches.

like image 27
Dmitri Avatar answered Dec 05 '22 01:12

Dmitri