From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fcc2d88d867060e8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-19 13:31:43 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!bigfeed2.bellsouth.net!bigfeed.bellsouth.net!news.bellsouth.net!peer01.cox.net!cox.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: load and use a ".o" file? Date: 19 Dec 2003 21:28:56 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1071869502 13693 62.49.19.209 (19 Dec 2003 21:31:42 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Fri, 19 Dec 2003 21:31:42 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:3584 Date: 2003-12-19T21:28:56+00:00 List-Id: lifetime n00b 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