Non-shared library base

2 posts / 0 new
Last post
drule
drule's picture
Offline
Last seen: 3 years 1 month ago
Joined: 2015-07-02 01:13
Non-shared library base

Does anybody have a good reference (or possibly just explain) how a library base is constructed for a "non-shared" scenario? I'm thinking something like bsdsocket.library where you're supposed to open the library per-task/process.

Is it a case of constructing the "root" library base as normal, which is presumably the one that gets added to the system list; then in the LibOpen() function construct a task-specific base using CreateLibrary (v50+) or MakeLibrary (v36+) with, maybe, a pointer back to "root" for internal purposes? LibClose() would then deallocate the per-task base while expunging would remove the "root", perhaps?

It makes sense that the base returned from LibOpen() is the one the task will use but I'm a little unclear how to construct it all and any help would be appreciated.

Thx.

hypex
hypex's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 2011-09-09 16:20
Re: Non-shared library base

Actually, your pretty much on the ball here. It would be controlled by the LibOpen() and LibClose() constructor and deconstructor. A standard library just adjusts the open count and returns the base after any other business it needs to do.

You can customise it by creating a new instance for each open call. On OS4 the interface will contain a back pointer to the head library and for OS3 you can simply store the head library in the library data. Or use some kind of absolute or PC relative data model so you can access your data out of your task context.

The easiest way to program a non-shared library is to use AmigaE! This is the only library model AmigaE supports so it does it all for you. I suspect this may not be what you want, in case you are using C, so check out these links. They go into library creation and management. But don't specifically use a non-shared model. The most well known example would be bsdsocket.library, so perhaps Olaf Barthel can be buzzed on the subject.

https://wiki.amigaos.net/wiki/How_to_create_an_AmigaOS_4_library

https://wiki.amigaos.net/wiki/Exec_Libraries

Log in or register to post comments