Without more information, I'd say probably GCC, which is multi platform and well supported by IDEs, if you want one. On unix the default output is ELF, on the windows MinGW port it is PE exe.
I don't have example code for loading the binary because I use FASM macros to merge it into my ASM module at compile time but you can lookup the PE/ELF header definitions and do this at run time. For a 64bit target, I use:
Quote: |
|
gcc -nostdinc -O2 -Wall -Werror -c -fPIC -omain.o ../main.c -m64
gcc -nostartfiles -nodefaultlibs -nostdlib -o./release/main.run main.o -m64
|
|
to compile the top level C module. Because there is no stdlib, the entry point in main.c is now "void _start()" which is the equivalent of "int main(int,char*[])" in a normal program.