开发者

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

开发者 https://www.devze.com 2023-04-12 21:04 出处:网络
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

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>
开发者_如何学Python

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)


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.


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.


There's Turbo C++ 1.01, not so modern, though, that appears to have all these header files as well. I still occasionally use it.


You might try using DJGPP. According to the documentation, it may have the headers you need.


a) Remove all the header files b) Try a compile c) Look up which header file the undefined function/type is int d) Add the header file e) repeat

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号