I have a question about binary executables
I've been starting to use gcc in fedora 8 to compile and run programs in C. I have a dual boot system going with fedora 8 and win xp. My question is, since I compile the src code into an executable binary file (a.out) in fedora 8 using gcc, and since both OS are obviously running the same cpu architecture x86, theoretically, this a.out executable binary file should run in winxp, right? I don't need a cross compiler if the program is in binary machine code that my processor can understand. Is my understanding correct?
How would I go about running a.out in winxp? Is there some command in cmd? |
Loading The Image
I believe this has to do with the linker and the instructions necessary to get your executable image loaded into memory and run. There is wine to go from Windows to Linux, and perhaps with the right libraries you might be able to run this under cygwin, but I've never tried it. I would conditionally compile the source for either OS.
|
I thought that since a.out is broken down into machine code(binary), that it isn't necessary to load libraries since the source code is already interpreted into machine language. Theoretically, it should work by simply loading into memory.
|
No it won't work. Not only are the system calls different, an elf file is different than a windows executable.
|
"a.out" is AFAIK a really old format - todays standard is "ELF"
No - a binary (or a library) compiled to run on linux is not going to run on windows. Wether a.out or ELF - makes no difference there. |
jomen : a.out is just the object, you are getting from gcc,
when no object name is specified, still an ELF file. I think, I read that it was changed in gcc-4.3 (released 18 days ago ?). Rgds |
Though I run Gentoo I don't know much of this except that I remember now that you are saying this - you are right.
But then again - isn't this just the name? I guess I'm confused by the text I quite often read when configuring a new kernel: Section: Executable file formats [*] Kernel support for ELF binaries < > Kernel support for a.out and ECOFF binaries <*> Kernel support for MISC binaries the help-texts on the second: Quote:
|
Seems to be more than one explanation, googling a.out,
most say "old" and... http://www.ncsa.uiuc.edu/UserInfo/Re...iles/a.out.htm Rgds |
All times are GMT -5. The time now is 10:58 PM. |