POV-Ray : Newsgroups : povray.off-topic : Dynamic loading : Re: Dynamic loading Server Time
29 Jul 2024 20:27:57 EDT (-0400)
  Re: Dynamic loading  
From: Darren New
Date: 19 May 2011 12:14:46
Message: <4dd541f6@news.povray.org>
On 5/19/2011 8:55, Invisible wrote:
> is there some way to execute it?

Yes. An assembly languge JSR will do the trick.

A COM file is raw machine code without any headers, at least on CP/M. A COM 
file was executed by reading it into 0x100 and branching to 0x100.

Again, what language are you talking about?

> 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.

No, the point of *that* is to (a) allocate the memory, (b) load the DLL, (c) 
link the DLL entry points into your own code so that (d) you don't have to 
recompile your code when the DLL gets replaced by a newer version. Also (e) 
multiple people can use the same code at the same time and only load it once.

> - 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.)

It means the DLL has to get relocated when it gets loaded in.

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

No more than an EXE does.

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

It's not insanely hard. It's just inflexible.

> 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?

The expression you're looking for is PIC, "Position Independent Code".


-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

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