Thread: PDOS for Amiga
View Single Post
Old 04 March 2021, 10:10   #34
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,292
Quote:
Originally Posted by kerravon View Post
Yes, but that's my question. At some point I would like to write that "startup code".
The line I placed there is (part of) the startup code.


Quote:
Originally Posted by kerravon View Post
I'm trying to scope the problem. I'd like to know how OpenLibrary() manages to return that DOSBase pointer (DOSBase in particular, that's probably the only one I actually care about) to the caller.
In a nutshell, OpenLibrary() is part of the exec.library, and as part of the call, it receives the SysBase library implicitly as its argument. What OpenLibrary() does is that it searches the available libraries in SysBase, present there, and searches over the libraries, and returns the one named "dos.library".


Code:
struct Library *OpenLibrary(const char *name) 

{
  struct Library *l;


 for(l = SysBase->LibList.lh_Head;l->lib_Node.ln_Succ;l = l->lib_Node.ln_Succ) {
 if (!strcmp(name,l->lib_Node.ln_Name))
   return lib;
 }


 return NULL
}

Of course, there's a bit more than this (version checking, disk access if not found), but that's the pattern. There is no interrupt here anyhwere.






Quote:
Originally Posted by kerravon View Post

Is the entire dos.library linked in to every executable, and even if it is, is the Read() functionality (accessed via DOSBase) just a "stub" that does an interrupt, or does it link to some DLL somehow?
There is nothing linked. The executable just retrieves the library pointer, and in that library is an array of functions, one of which is Read(). In old times, there was still a set of "stub functions" in amiga.lib which called through the function pointer array of the library, but today, most compilers create the indirect jump through the function pointer array of the library transparently.
Thomas Richter is offline  
 
Page generated in 0.05825 seconds with 11 queries