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,FREEMAIL_FROM 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 07:29:04 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!newshosting.com!news-xfer2.atl.newshosting.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr23.news.prodigy.com.POSTED!7db1df25!not-for-mail From: lifetime n00b User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031014 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: load and use a ".o" file? References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 216.63.105.42 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr23.news.prodigy.com 1071847706 ST000 216.63.105.42 (Fri, 19 Dec 2003 10:28:26 EST) NNTP-Posting-Date: Fri, 19 Dec 2003 10:28:26 EST Organization: SBC http://yahoo.sbc.com X-UserInfo1: FKPO@MC@@S@MBWLXDZHTOQTDFZ\@@FXLM@TDOCQDJ@_@FNHCYFWUQBKZQLYJX\_ITFD_KFVLUN[DOM_A_NSYNWPFWNS[XV\I]PZ@BQ[@CDQDPCL^FKCBIPC@KLGEZEFNMDYMKHRL_YYYGDSSODXYN@[\BK[LVTWI@AXGQCOA_SAH@TPD^\AL\RLGRFWEARBM Date: Fri, 19 Dec 2003 15:28:26 GMT Xref: archiver1.google.com comp.lang.ada:3557 Date: 2003-12-19T15:28:26+00:00 List-Id: tmoran@acm.org wrote: > If you are not talking about using an existing dynamic linker/loader, > then you are clearly talking about developing your own. In your example, > HiThere may need to make calls (for memory allocation for the string, for > instance) on the Ada Run Time System of the main program. So you will > need to load the code from the .o file and then modify call addresses, ie, > link, the loaded HiThere function. You should be able to find the > information you need by looking at the Gnat source code. > What problem are you trying to solve? Perhaps there's an easier way. Well, the "Big Picture" is that I'm wanting to write a Common Lisp system in Ada (yes I know, it probably sounds like heresy to both the Lisp and Ada camps), and I want to use gnat as the back-end compiler. Contrary to popular opinion, Lisp is not simply an interpreted language. One feature of a complete Common Lisp system is that source files can be compiled and loaded while the top-level system is running. Some implementations (such as CLISP) use byte-code compilation, but most compile to native code. Some use their own built-in compilers, while others first translate the Lisp code to C and use gcc as the back-end compiler and then load and use that compiled file. From what I can tell, it seems that GCL and ECL use gcc to compile the files as dynamic load (.so) files and then call dlopen() on that file. 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.