3 ms·
exec.library is a great design. The way programs know nothing except for AbsExecBase, and it points to a table of function pointers of which you have the offset
by Flow 11y ago
exec.library is a great design. The way programs know nothing except for AbsExecBase, and it points to a table of function pointers of which you have the offsets of.
In a sense it was a Component Object Model(COM) like the one in Windows. You call exec->OpenLibrary("name of lib", version_of_lib) and it returns a pointer to a table of function pointers of which you know the offsets of. It could even handle multiple versions of a library in principle. In reality makers of libraries just made sure the function table was the same, and added new stuff at the end.
You have to call CloseLibrary(libptr) to release the instance. Pretty similar to Objective-C's and COM's release().
OpenLibrary was allowed to return a different pointer for each call, but the early exec.library did not do this AFAIK.
Great design really. And how signals and message system works is just beautiful as well. I really get why Matt Dillon(of FreeBSD and DragonflyBSD) wanted something similar in the BSD kernel.
I still have the Amiga Kernel Reference Manual for exec in my shelf.