Operating System - HP-UX
1828359 Members
3149 Online
109976 Solutions
New Discussion

To run a C executable on DOS which has been compiled in UNIX

 
Mahesh_3
Occasional Contributor

To run a C executable on DOS which has been compiled in UNIX

I have compiled a C program and then ftp'd the executable to DOS. How can I run it, if at all I can run it???
A mech engineer learning computers!!!
4 REPLIES 4
Antoanetta Naghiu
Esteemed Contributor

Re: To run a C executable on DOS which has been compiled in UNIX

You need to ftp the source, re-compiling, correct possible errors before you might be able to run it. It is not guaranty will run, but can try. Depends on how complwex is the program, wha resources required.... Good luck
Bill Hassell
Honored Contributor

Re: To run a C executable on DOS which has been compiled in UNIX

Compilers translate programs into machine code designed for a specific computer and operating system. DOS runs on Intel PC hardware while HP-UX runs on PA-RISC hardware. There is nothing in common with these platforms for executable programs.

You'll have to get a C compiler for the PC and compile the program there. Be sure to read the compiler manual for program contructs that may not be the same between Unix and DOS.


Bill Hassell, sysadmin
Anthony Goonetilleke
Esteemed Contributor

Re: To run a C executable on DOS which has been compiled in UNIX

The best idea would be to get gcc which runs under unix and dos machines. Then compile the source on both machines. If you wanted to be very clever you could actualy have an NFS share across both machines and have an rexec that first off the compliler on the dos box ever time you compile it under Unix, its fairly easy to do.

Minimum effort maximum output!
Rick Garland
Honored Contributor

Re: To run a C executable on DOS which has been compiled in UNIX

There would be certain options to compile a program for different platforms. UNIX to DOS I don't believe is one of those. If the code contains threading and is designed for multi-user use, DOS is not going to handle it. try to compile on a DOS system, correct the errors until you have a DOS program that compile cleanly.