Comments: Authenticated sender is From: "Cory C. Albrecht" Organization: Wolf in the Fold To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Wed, 25 Oct 1995 17:35:34 -0500 Subject: Re: Is it possible to load .o files a run time and execute Reply-To: cca AT mgl DOT ca On 25 Oct 95 at 11:36, A.Appleyard wrote about Re: Is it possible to load .o files: > cca AT mgl DOT ca (Cory C. Albrecht) wrote (Subject: Is it possible to load > .o >files a run time and execute them?):- >> Without worrying about external references for the moment, is it >> possible to load .o files into memory and run their code? I'm > But you WILL have to worry about external references! Even if you > avoid all >explicit external references, the compiler will provide a few >automatically. Well, duh! Of course there are going to external references - any call to a library function will produce them. However, external references are the least of one's worries in a case like this. Does a .o file have all the information required, or does ld perform some extra magic on them by adding new data or what ever? That is what I wanted to know. If the .o file has all the necessary information then resolving external references becomes essentially trivial - the loading file resolves all the external references in a way similar to how an operating system resolves relocatable addresses in an executable file. That is a part of the puzzle I already know I can do. I just want a little more information before I make the big step in deciding whether I am going to write routines that load .o files or a.out files (with a main() that goes no where, making it similar to the stub on Windows or OS/2 files that says "This programme cannot be run in DOS mode"). Cory C. Albrecht "We think you should see a psychiatrist." "Is it that obvious?" Go to http://www.mgl.ca/~cca/menno.html and sign on to the World Wide MennoWeb Address Database! Help make it _the_ on-line "phone"book for Mennonites!