Re: Is C portable from PC to UNIX
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Tue, 31 Jan 2006 21:11:45 +0000 (UTC)
In article <1138740584.468926.91790@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
John Bode <john_bode@xxxxxxxxxxx> wrote:
>emmitsuks wrote:
>> Can I compile C source in an PC editor like Miracle, build it, and then
>> take that .exe over to Unix and run it there?
>If you use a cross-compiler and build for the target machine, then yes.
> However, an executable built *for* Windows on x86 will not run
>natively on Unix, especially if that Unix is running on different
>hardware (PPC, MIPS, PA-RISC, Sparc, etc.).
<OT>
Though if you happen to want to run the Windows x86 code on an x86
based machine running any of several Unices or Unix-like systems
such as Linux, then there are free and commercial programs that
apparently do fairly good jobs of running the code. For non-x86
systems there are virtual machines or emulators available that
can run the x86 Windows code... possibly slowly.
One option to consider is to do the development on Windows but using
a Unix emulation library such as MingW or AT&T's UWIN; once that code
was working, taking the -source- to a Unix system and rebuilding would
usually be within a reasonable amount of work. But there are quite
a few flavour of Unix, so sometimes it does turn out to be a lot of
work, depending exactly what you are doing.
You can reduce the amount of work required to "port" a program
from Windows to Unix, by restricting yourself to the facilities provided
by the C language, and avoiding graphics, GUIs, networking, or
anything that needs to know about the "inside" of how the system
does its work. This newsgroup, comp.lang.c, often has discussions
about what is or is not part of the C language, so it is a good place
to visit if you want to write programs that are intended to be as
portable as practical.
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
.
- References:
- Is C portable from PC to UNIX
- From: emmitsuks
- Re: Is C portable from PC to UNIX
- From: John Bode
- Is C portable from PC to UNIX
- Prev by Date: Re: NULL with representation other then all bits 0
- Next by Date: Re: Texinfo C code source reference (through doxygen) ?
- Previous by thread: Re: Is C portable from PC to UNIX
- Next by thread: Re: Is C portable from PC to UNIX
- Index(es):
Relevant Pages
|