POV-Ray : Newsgroups : povray.off-topic : Does anybody know this? Server Time
14 Nov 2024 22:23:28 EST (-0500)
  Does anybody know this? (Message 1 to 10 of 31)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Orchid XP v7
Subject: Does anybody know this?
Date: 30 Nov 2007 14:59:15
Message: <47506b93$1@news.povray.org>
I'm just being nosy now... How do you call OS functions on Windoze?


Back in the days of the Commodore 64, the "operating system" (I use the 
term loosely) was stored in a big ROM chip. To call the OS (assuming you 
actually wished to do such a thing!) you simply jump to the right magic 
address. Since it's in ROM, it never moves. And indeed, you could buy 
big tables of addresses and the expected parameters...


In the days of the Amiga, things became a little more complex. The OS is 
composed of "libraries". Some of these are burned into ROM, while others 
reside in files on disk. But even the ones in ROM are in a slightly 
different place depending on exactly which model of Amiga you have.

All is not lost, however. Memory address 0x00000004 contains a base 
pointer to a "jump table". If you take this base address and add on what 
they call a "library vector offset" (LVO), you can access any function 
provided by the Exec library. And, again, for a large sum of money, you 
could buy a file containing either C or assembly declarations of all the 
function names and their corresponding LVOs.

The two important functions provided by Exec are of course OpenLibrary() 
and CloseLibrary(). The former takes a pointer to a zero-terminated 
string indicating the desired library name, and an integer indicating 
the minimum acceptable library version. On return, there's a status code 
indicating whether the library could be opened, and if so, what version 
was actually found, and a base pointer to its jump table. Now again you 
need to know the LVOs for the functions you want to call.

(If the library is on disk, Exec will load it for you. When you close 
it, Exec might unload it if nobody else is using it.)


How does this stuff work with Windoze? (Or Linux, for that matter...)


Post a reply to this message

From: Mike Raiford
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 15:43:33
Message: <475075f5$1@news.povray.org>
Orchid XP v7 wrote:

> How does this stuff work with Windoze? (Or Linux, for that matter...)

Dynamic link libraries (DLLs) two ways to get to them, either through 
the linker, or through dynamic loading through calls to LoadLibrary and 
GetProcAddress. The easiest way is using the linker, of course, provided 
you have the header & library files (which you should for any windows 
compiler available). The DLL loader does all of the procedure address 
fix-ups, if a DLL is loaded into its preferred address space (i.e. no 
other DLL is occupying the address space it requests), then loading is 
much quicker since all of the pointers in the function table are 
correct. Alternatively, some functions, such as those in the DirectX and 
Shell libraries use COM, in which instances of classes are loaded with 
vtables pointed to the correct functions. DirectX (and Shell, I think) 
export non-COM functions for creation of the COM class instances.

* This is simplified and largely from memory, so take it for what its 
worth (not much). This is also the case for Win32, Win16 may be 
different, Win64 should be similar, though.


Post a reply to this message

From: Mike Raiford
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 15:45:07
Message: <47507653$1@news.povray.org>
Mike Raiford wrote:
> Orchid XP v7 wrote:
> 
>> How does this stuff work with Windoze? (Or Linux, for that matter...)
> 
> Dynamic link libraries (DLLs)

Oh, yeah... the answer only applies to Windows, Linux I haven't a clue.


Post a reply to this message

From: Jim Henderson
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 16:34:10
Message: <475081d2$1@news.povray.org>
On Fri, 30 Nov 2007 14:41:47 -0600, Mike Raiford wrote:

> Mike Raiford wrote:
>> Orchid XP v7 wrote:
>> 
>>> How does this stuff work with Windoze? (Or Linux, for that matter...)
>> 
>> Dynamic link libraries (DLLs)
> 
> Oh, yeah... the answer only applies to Windows, Linux I haven't a clue.

On Linux it's similar; you have a set of standardized libraries that 
interface with lower level aspects of the kernel.  As I understand it, 
architecturally, you could call those kernel functions directly (and in 
fact in many cases you would do this, for example, to do thread 
management).

Jim


Post a reply to this message

From: John VanSickle
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 16:35:47
Message: <47508233@news.povray.org>
Orchid XP v7 wrote:
> I'm just being nosy now... How do you call OS functions on Windoze?
> 
> 
> Back in the days of the Commodore 64, the "operating system" (I use the 
> term loosely) was stored in a big ROM chip. To call the OS (assuming you 
> actually wished to do such a thing!) you simply jump to the right magic 
> address. Since it's in ROM, it never moves. And indeed, you could buy 
> big tables of addresses and the expected parameters...

Commodore released a manual for the C64 that had EVERYTHING about the 
machine, including schematics.  It contained everything you needed to 
write any application.

> In the days of the Amiga, things became a little more complex. The OS is 
> composed of "libraries". Some of these are burned into ROM, while others 
> reside in files on disk. But even the ones in ROM are in a slightly 
> different place depending on exactly which model of Amiga you have.
> 
> All is not lost, however. Memory address 0x00000004 contains a base 
> pointer to a "jump table". If you take this base address and add on what 
> they call a "library vector offset" (LVO), you can access any function 
> provided by the Exec library. And, again, for a large sum of money, you 
> could buy a file containing either C or assembly declarations of all the 
> function names and their corresponding LVOs.

Addison-Wesley released a very extensive set of docs for the Amiga, 
consisting of five volumes.  One concerned programming at the hardware 
level, another dealt with the Exec library, a third with the Intuition 
library, and the last with all of the others (Graphics, Layers, Sound, 
etc.).  I'm pretty sure the vector table offsets for every OS call were 
in these books.

> The two important functions provided by Exec are of course OpenLibrary() 
> and CloseLibrary(). The former takes a pointer to a zero-terminated 
> string indicating the desired library name, and an integer indicating 
> the minimum acceptable library version. On return, there's a status code 
> indicating whether the library could be opened, and if so, what version 
> was actually found, and a base pointer to its jump table. Now again you 
> need to know the LVOs for the functions you want to call.
> 
> (If the library is on disk, Exec will load it for you. When you close 
> it, Exec might unload it if nobody else is using it.)
> 
> 
> How does this stuff work with Windoze? (Or Linux, for that matter...)

For Windows, I think that the library code is mostly in DLLs, and that 
your linker will add the appropriate OS calls to get any needed DLLs 
into memory.

Dunno how it works in Linux.

Regards,
John


Post a reply to this message

From: Le Forgeron
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 16:57:16
Message: <4750873c$1@news.povray.org>
Le 30.11.2007 20:59, Orchid XP v7 nous fit lire :

> (If the library is on disk, Exec will load it for you. When you close
> it, Exec might unload it if nobody else is using it.)
> 
> 
> How does this stuff work with Windoze? (Or Linux, for that matter...)

Shared lib on linux/unix can be dynamically loaded too.
The classical libdl (dlopen,dlsym,dlclose) can be used on linux &
solaris.
hp-ux have shl_load...


-- 
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius


Post a reply to this message

From: Sabrina Kilian
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 19:49:06
Message: <4750af82$1@news.povray.org>
Orchid XP v7 wrote:
> How does this stuff work with Windoze? (Or Linux, for that matter...)

The simple way for Linux, include the header file and tell the linker
the path to object files. In fact, that should work for Windows as well.


Post a reply to this message

From: Warp
Subject: Re: Does anybody know this?
Date: 30 Nov 2007 21:46:30
Message: <4750cb06@news.povray.org>
Orchid XP v7 <voi### [at] devnull> wrote:
> How does this stuff work with Windoze?

  When you have your compiler installed, you download the Windows SDK
which contains the necessary header files. Then you call the functions
defined in these header files.

> (Or Linux, for that matter...)

  Most system-specific headers are defined in /usr/include/sys, although
these are seldom needed in practice (ie. only when you really need to do
something which you can't do with standard code).

-- 
                                                          - Warp


Post a reply to this message

From: somebody
Subject: Re: Does anybody know this?
Date: 1 Dec 2007 00:40:13
Message: <4750f3bd$1@news.povray.org>
"Orchid XP v7" <voi### [at] devnull> wrote

> provided by the Exec library. And, again, for a large sum of money, you
> could buy a file containing either C or assembly declarations of all the
> function names and their corresponding LVOs.
> [...]
> How does this stuff work with Windoze? (Or Linux, for that matter...)

For starters, you don't pay large sums of money. No wonder Amiga is dead.


Post a reply to this message

From: Orchid XP v7
Subject: Re: Does anybody know this?
Date: 1 Dec 2007 04:59:28
Message: <47513080$1@news.povray.org>
somebody wrote:
> "Orchid XP v7" <voi### [at] devnull> wrote
> 
>> provided by the Exec library. And, again, for a large sum of money, you
>> could buy a file containing either C or assembly declarations of all the
>> function names and their corresponding LVOs.
>> [...]
>> How does this stuff work with Windoze? (Or Linux, for that matter...)
> 
> For starters, you don't pay large sums of money. No wonder Amiga is dead.

This was in the days before the Internet revolution. Towards the end, it 
was possible to get hold of the include files from BBS and so on. (I 
think even one issue of AmigaFormat had it on a coverdisk...)


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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