comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: load and use a ".o" file?
Date: 19 Dec 2003 21:28:56 +0000
Date: 2003-12-19T21:28:56+00:00	[thread overview]
Message-ID: <x7vu13wpkdj.fsf@smaug.pushface.org> (raw)
In-Reply-To: uOEEb.3352$rx2.672@newssvr23.news.prodigy.com

lifetime n00b <anonymous@yahoo.com> writes:

> I was thinking that it would be more efficient (and more portable)
> to not use .dll or .so files, but to load and use the .o object
> files directly in some way. And if I could figure out how to do it
> with the example I described in the OP, then I could just expand on
> that to accomplish what I'm ultimately aiming towards.

I realise it is most unlikely that your target OS is VxWorks, but
there may be some help to be gleaned ..

The way you build Ada for VxWorks (well, with GNAT) is

* you do the bind as normal, this generates (among other things) the
  elaboration code in adainit and a call to it followed by a call to
  your program entry point

* the link is done (like any other VxWorks link) as a partial link (I
  think that's the right word, the basic command is ld -r), so that no
  VxWorks runtime is included but the GNAT runtime is

* the result is downloaded to the target and relocations resolved
  there, against the symbol table (I am a little hazy about exact
  details here, but it is certainly possible to do this download from
  eg flash memory, so the symbols must be resident).

For C under VxWorks there is no elaboration so you can just download a
.o.

For Ada it would be more tricky. You really do need that elaboration
code to get called. And you have to be sure that the runtime is
already present. And it may need elaboration too. And it may be wrong
to re-elaborate parts of the runtime that have been elaborated by the
already-running program.

All this sounds like a very interesting project!

One thought -- I'm not sure what the difference is between a .o and a
.so, they are both ELF files (on Linux anyway), I wonder if dlopen etc
would work with .o's?

-S



      parent reply	other threads:[~2003-12-19 21:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-18 23:31 load and use a ".o" file? lifetime n00b
2003-12-18 23:59 ` Stephen Leake
2003-12-19  1:51 ` tmoran
2003-12-19 15:28   ` lifetime n00b
2003-12-19 18:08     ` Stephen Leake
2003-12-20 20:12       ` lifetime n00b
2003-12-20 21:15         ` tmoran
2003-12-20 23:41           ` lifetime n00b
2003-12-21  7:15             ` tmoran
2003-12-21 11:46         ` Simon Wright
2003-12-21 13:57         ` Stephen Leake
2003-12-22 19:29           ` lifetime n00b
2003-12-22 20:49           ` Jon S. Anthony
2003-12-22 23:15             ` Stephen Leake
2003-12-23  1:36               ` tmoran
2003-12-27 22:55               ` Jon S. Anthony
2003-12-28  3:28                 ` Stephen Leake
2003-12-28 16:14                   ` Georg Bauhaus
2003-12-29 22:45                     ` Jon S. Anthony
2003-12-29 22:42                   ` Jon S. Anthony
2003-12-30 15:17                     ` lifetime n00b
2003-12-30 16:56                     ` Stephen Leake
2003-12-22 15:50         ` Mark H Johnson
2003-12-22 19:46           ` lifetime n00b
2003-12-22 22:58             ` Mark H Johnson
2003-12-23 17:48               ` Robert I. Eachus
2003-12-23 17:59                 ` Mark H Johnson
2003-12-23 21:53                   ` Robert I. Eachus
2003-12-19 21:28     ` Simon Wright [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox