ta0kira |
06-13-2005 02:49 AM |
The difference is the binary interface with the operating system. Both C and C++ are generic in that they do not favor a particular OS by definition; they define how the language works, and the processing behavior that a binary resulting from an OS-specific compile must have. The compilers used for each OS are designed around this, however they use different assembly languages and generate different binary files, but technically should operate the same if they are written in pure C/C++. The major difference comes when you decide to use OS-specific features, such as DLLs or shared libraries. These require the support of the kernel, and therefore require different incompatible sources. Also, the GUIs for X-windows and Windows are not compatible, therefore making their implementations non-portable. When the code is compiled, it becomes a binary file that has instructions that specifically work for the kernel being used; binaries for Windows don't make sense to Linux/Unix, and likewise. Some reasons a lot of Linux/Unix software is distributed as source code are 1) the open-source initiative, 2) "all" POSIX-compatible systems have a compiler, and the kernels/system setups used are so diverse that there is no reasonable way to standardize the binaries, so why not create a binary specific to your system? 3) having non-standardized binaries allows for a diverse spectrum of compatible systems. The reasons you don't get sources with Windows/DOS software is because 1) MS is closed-source, 2) Windows is Windows is Windows, 3) DOS is DOS is DOS. If you are interested in what a compiler does, look at this:
http://www.angelfire.com/dragon/lets...ials/compiler/
ta0kira
|