-
conditional compilation
I was just reading this other thread about conditional compilation for DOS, or Unix. Well, I understand that the header files are going to be different, but if you compile (let's say in VC in Windows) a console program, you can run it on Unix, right? Because it is already compiled into the executable file. Am I correct? This has always been fuzzy to me. Thanks.
--Garfield
-
> but if you compile (let's say in VC in Windows) a console
> program, you can run it on Unix, right?
No. Linux binaries will not run on Windows (and vice versa) without emulation. This is why there are console emulators and such, because the native binaries do not run on other operating systems / hardware.
Quzah.
-
Okay, let me get this straight with a little story:
I, Garfield, am an aspiring programmer and so is my friend Odie. Garfield uses and programs in Windows. Odie uses and programs in Unix. I call Odie up and tell him that I just wrote this great program and Odie wants it. But, I can't send him the exe because it is platform dependant. So, I have to send him the source code with conditional compilation for him to run it on his Unix system.
Is this right? Thanks.
--Garfield
-
> So, I have to send him the source code with conditional compilation for him to run it on his Unix system
That's the way it's done, yes.
Basically, anything which isn't ANSI-C will probably need conditional compilation controls around it, so that you get the appropriate code for each platform.
-
Oh, thanks for the help. Makes sense now. Thanks again.
--Garfield