Tag Info

New answers tagged

-2

An important distinction at this point is separating the compiler from the linker. The compiler most likely produces more or less the same output (the differences mostly being due to various #if WINDOWSs). The linker, on the other hand, has to handle all the platform specific stuff - linking the libraries, building the executable file etc. In other words, ...


3

Actually, the real answer is that if every OS did understand the same executable binary file layout, and you only limited yourself to standardized functions (like in the C standard library) that the OS provided (which OSes do provide), then your software would, in fact, run on any OS. Of course, the reality is that's not the case. An EXE file doesn't have ...


5

From another answer of mine: Consider early DOS machines, and what Microsoft's real contribution to the world was: Autocad had to write drivers for each printer they could print to. So did lotus 1-2-3. In fact, if you wanted your software to print, you had to write your own drivers. If there were 10 printers, and 10 programs, then 100 ...


4

The diagram has the "application" layer (mostly) separated from the "operating system" layer by the "libraries", and that implies that "application" and "OS" don't need need to know about each other. That is a simplification in the diagram, but it's not quite true. The problem is that the "library" has actually three parts to it: the implementation, the ...


3

You say software produced using programming languages for certain operating systems only work with them But the program you give as an example will work on many operating systems, and even some bare-metal environments. The important thing here is the distinction between the source code and the compiled binary. The C programming language is ...


30

You mention on how if the code is specific to a CPU, why must it be specific also to an OS. This is actually more of an interesting question that many of the answers here have assumed. CPU Security Model The first program run on most CPU architectures runs inside what is called the inner ring or ring 0. How a specific CPU arch implements rings varies, but ...


2

Software is not always OS specific. Both Java and the earlier p-code system (and even ScummVM) allow for software that is portable across Operating Systems. Infocom (makers of Zork and the Z-machine), also had a relational database based on another virtual machine. However, at some level something has to translate even those abstractions into actual ...


6

There are a number of reasons, but one very important reason is that the Operating System has to know how to read the series of bytes that make up your program into memory, find the libraries that go with that program and load them into memory, and then start executing your program code. In order to do this, the creators of the OS create a particular format ...


40

As you can see, APIs are not indicated as a part of the operating system. I think you are reading too much into the diagram. Yes, an OS will specify a binary interface for how operating system functions are called, and it will also define a file format for executables, but it will also provide an API, in the sense of providing a catalog of functions ...


9

Is the compiler doing anything OS specific when compiling this? Probably. At some point during the compiling and linking process, your code is turned into an OS-specific binary and linked with any required libraries. Your program has to be saved in a format that the operating system expects so that the OS can load the program and start executing it. ...


1

There are sometimes minor annoyances in porting code from Linux to OS X. For example, until Lion, OS X didn't provide a 'getline()' function, so you were forced to provide your own. Then when Apple added it in Lion, you had to have conditional compilation to include the home grown getline() when building on Snow Leopard, and leave it out when building on ...


1

Most of the time you should be fairly safe. OS-X is based on BSD which, like Linux, is a variant of Unix, albeit one of the more different versions. It does however have very similar kernel and OS calls, and is considered to be Posix compliant, which is the main thing needed for cross platform operation. The biggest issue your going to face when it comes ...


1

Instead of compiling from scratch have you investigated Homebrew MacPorts and Fink.All of these port unix tools to OSX with the heavy lifting already done for you. they also provide porting guides to enable you to port your own applications. Each of these systems has its own adherents but to be honest they are much of a muchness, each has strengths and ...


4

By many different methods, not easily reduced to just a few paras. Here are some, in roughly ascending order of abstraction. The OS implements one or more privileged instructions (trap, syscall, etc). The compiler emits code to translate certain language constructs into those instructions. [ASM] The OS provides an API in a form compatible with the external ...


2

By separating fork() and execve() you let the parent control the environment that the child inherits. The most common example is the shell redirecting IO, for example in the following command: find . -name '*.java' | grep Frob In this example, the standard output of find is attached to the standard input of grep. These are two distinct file descriptors, ...



Top 50 recent answers are included