Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.wizards Subject: Re: Loading and Executing Object Code at Runtime Message-ID: <1991Feb15.173024.15506@convex.com> Date: 15 Feb 91 17:30:24 GMT References: <1991Feb13.212704.7016@cec1.wustl.edu> <437@bria> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 18 Nntp-Posting-Host: pixel.convex.com From the keyboard of uunet!bria!mike: :If you're trying to do what it looks like you're trying to do, the answer :is "you can't get there from here." You would have open the object file, :load the function within the context of the current process (a real trick), :allocate the core for data, stack, and bbs, push the stack frame, and :jump to the address of this arbitrary function. Just ain't no way you :can be doin' this in user mode. Never say never. It certainly is on some architectures. Just malloc or mmap in some pages as RWX, then load the position-independently compiled functions in there from disk, and call through a function pointer. There are also overlay schemes available -- that's what I used to do on Z80 machines. You could also use overlays on PDP-11's. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "All things are possible, but not all expedient." (in life, UNIX, and perl)