How to get GCC to compile to binary, but in raw format NOT ob ject
Ian Lance Taylor
Mon Sep 15 16:56:00 GMT 2003
"DAWE,STEVE \(HP-UnitedKingdom,ex2\)" <firstname.lastname@example.org> writes:
> Thanks for your help, but what I need goes beyond even a DSO, I want to be
> able to compile, link execute a C program, later on compile a C function to
> binary, load this into memory using a malloc/fread combination into the
> original program and then execute it from there. With a DSO, you need to
> know the function name, parameters etc in advance, so you link a stub which
> then call the DSO code itself.
Look at dlopen/dlsym.
If you don't even know the name of the function you want to call, then
you need something quite a bit more clever, at least if you want the
function you load to be able to call library functions which have
already been loaded.
More information about the Gcc-help