Re: Is C portable from PC to UNIX



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
.



Relevant Pages

  • Re: Help from fellow Fortran Users
    ... >> of the UNIX and Linux communities or to the intensity of general desire ... > difference in fklavor between UNIX and Windows. ... of a language useful for writing portable programs. ...
    (comp.lang.fortran)
  • Re: What is the more popular UNIX flavor?
    ... about my experience with Solaris and Cygwin. ... installing packages. ... needing eg tftp you only need to activate on a Unix system. ... probably need installing first on the equivalent Windows system. ...
    (comp.unix.questions)
  • Re: Five Architectural Flaws in Windows Solved In Mac OS X
    ... But it is still an improvement over Unix, wherein *any executable* can be highly privileged and interact with the user. ... The usual security precautions prevent unauthorized people from doing this, but that's true on Windows also. ... I just got thru upgrading the wifes Mac to Tiger and hpfs is the default. ... This is a more advanced design that Unixes have been trying to duplicate by adding thread support. ...
    (comp.sys.mac.advocacy)
  • Re: Linux no threat to Microsoft
    ... originally developed for Unix. ... Windows has't come on any of the machines I've ever purchased. ... Yet over those years Linux Market Share on the desktop has actually ... philosophy of Apple - later adopted by Microsoft. ...
    (comp.os.linux.setup)
  • Re: OS X "Security" myths
    ... >> lot of UNIX systems down to their knees. ... >>> their code, so they concentrate on developing exploits for Windows, ... > It does tell me that there is not much "boast factor" for malware ... Just like the Hackers convention in Las Vegas known as ...
    (comp.sys.mac.advocacy)