public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: How to get GCC to compile to binary, but in raw format NOT ob ject
@ 2003-09-15 16:05 DAWE,STEVE (HP-UnitedKingdom,ex2)
  2003-09-15 16:56 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: DAWE,STEVE (HP-UnitedKingdom,ex2) @ 2003-09-15 16:05 UTC (permalink / raw)
  To: 'John Love-Jensen', DAWE,STEVE (HP-UnitedKingdom,ex2),
	'gcc-help@gcc.gnu.org'

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.

Steve

-----Original Message-----
From: John Love-Jensen [mailto:eljay@adobe.com]
Sent: 15 September 2003 16:51
To: DAWE,STEVE (HP-UnitedKingdom,ex2); 'gcc-help@gcc.gnu.org'
Subject: Re: How to get GCC to compile to binary, but in raw format NOT
object


Hi Steve,

You want a DSO (dynamic shared object).

Generate your code into a shared object (a .so in Unix-land, a .dll in
Windows-land, a .library in Amiga-land), and -- in Unix-land -- use dlopen
and the other dlxxxx functions when you want to access your routine
dynamically.  Windows and Amiga have equivalent mechanisms.

--Eljay

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to get GCC to compile to binary, but in raw format NOT ob ject
  2003-09-15 16:05 How to get GCC to compile to binary, but in raw format NOT ob ject DAWE,STEVE (HP-UnitedKingdom,ex2)
@ 2003-09-15 16:56 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2003-09-15 16:56 UTC (permalink / raw)
  To: DAWE,STEVE (HP-UnitedKingdom,ex2)
  Cc: 'John Love-Jensen', 'gcc-help@gcc.gnu.org'

"DAWE,STEVE \(HP-UnitedKingdom,ex2\)" <steve.dawe@hp.com> 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.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-15 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-15 16:05 How to get GCC to compile to binary, but in raw format NOT ob ject DAWE,STEVE (HP-UnitedKingdom,ex2)
2003-09-15 16:56 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).