POV-Ray : Newsgroups : povray.off-topic : Dynamic loading : Re: Dynamic loading Server Time
26 Sep 2024 17:44:56 EDT (-0400)
  Re: Dynamic loading  
From: Invisible
Date: 19 May 2011 11:55:55
Message: <4dd53d8b$1@news.povray.org>
On 19/05/2011 16:15, Darren New wrote:
> On 5/19/2011 2:50, Invisible wrote:
>> Depending on which operating system you're using, the OS provides various
>> ways to load code into memory and execute it. My question is this: How
>> hard
>> would it be to write a subroutine that can read raw machine code from
>> a flat
>> file and make it execute?
>
> In what language?

Most programming languages provide a way to suck the contents of a file 
into memory without modifying it. So I suppose the question is, once 
it's there, is there some way to execute it?

Presumably this must be very hard to do, otherwise people wouldn't jump 
through all the hoops required to get dynamic linking via the OS to work.

For example:

- According to Wikipedia, every Windows DLL in the entire system must 
have a unique base address. (I forget what happens if this isn't the 
case; I believe it amounts to poor performance.)

- According to the LFS book, every Linux dynamic library actually has 
the absolute path to the system linker program hard-coded into it. (This 
almost defies belief!)

- Obviously in both cases the actual machine code must also be 
surrounded by many miles of complex metadata too.

Presumably nobody would put up with such crippling limitations if doing 
it yourself wasn't insanely hard.

One thing about loading data from file is that you usually don't get to 
decide where it gets loaded. Is that a problem for x86? Is it hard to 
write relocatable machine code or something?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.