Porting DOS program to Linux. I have the C source code ...
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Rep:
Porting DOS program to Linux. I have the C source code ...
I got put in charge of this DOS program. I have the source code written in C, but when I use gcc, I get these errors about the header files missing:
Code:
gom3.c:8:17: error: dos.h: No such file or directory
gom3.c:9:17: error: dir.h: No such file or directory
gom3.c:10:19: error: alloc.h: No such file or directory
gom3.c:13:17: error: mem.h: No such file or directory
In file included from gom3.c:15:
standard.h:4:16: error: io.h: No such file or directory
standard.h:5:19: error: conio.h: No such file or directory
standard.h:11:22: error: sys\stat.h: No such file or directory
standard.h:12:19: error: share.h: No such file or directory
Those look very DOS specific. Any way I can get them or substitute for them?
gom3.c:8:17: error: dos.h: No such file or directory
gom3.c:9:17: error: dir.h: No such file or directory
gom3.c:10:19: error: alloc.h: No such file or directory
gom3.c:13:17: error: mem.h: No such file or directory
In file included from gom3.c:15:
standard.h:4:16: error: io.h: No such file or directory
standard.h:5:19: error: conio.h: No such file or directory
standard.h:11:22: error: sys\stat.h: No such file or directory
standard.h:12:19: error: share.h: No such file or directory
Those look very DOS specific. Any way I can get them or substitute for them?
Glibc has header files which perform similar functions. You can make sure that all of your function calls follow the glibc format and then substitute the glibc headers for the DOS headers.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Original Poster
Rep:
Quote:
Originally Posted by pljvaldez
Do you need to port the program, or would it be acceptable to use dosbox or FreeDos to run the program in a virtual machine?
I'm not a programmer, so I'm just sort of thinking outside the box.
I did try the program using FreeDOS and DOSbox, but unfortunately the performance is VERY poor. In fact, this DOS program ran faster in Windows Vista!
Quote:
Originally Posted by jailbait
Glibc has header files which perform similar functions. You can make sure that all of your function calls follow the glibc format and then substitute the glibc headers for the DOS headers.
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986
Original Poster
Rep:
Alright, this seems too messy for me. I need specific header files, and without them, certain functions in the code don't work because they depend on those headers. It would require a lot of rewriting of the code and cleaning up to make it work with gcc. Looks like it's time to pay a professional programmer to do this!
The header files conio.h & dos.h contain declarations of functions which are very DOS-specific. You will need to figure out how to achieve the functionality that these provide using only Linux style functions or systems calls. DOS C compilers played fast and loose with real-mode capabilities, which do not exist in a protected-mode OS.
--- rod.
Alright, this seems too messy for me. I need specific header files, and without them, certain functions in the code don't work because they depend on those headers. It would require a lot of rewriting of the code and cleaning up to make it work with gcc. Looks like it's time to pay a professional programmer to do this!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.