AmigaLabs / clib4

Clib4 for AmigaOS4
Other
14 stars 7 forks source link

[Discussion] Opening CLIB4 Shared Objects and clib4.library #211

Closed 3246251196 closed 1 week ago

3246251196 commented 1 week ago

Shared Objects

We should agree on some sort of standard for opening CLIB4 SOs. Right now, our dynamic loader will look in the PWD or the PWD/sobjs directory in preference to SOBJS:. That would mean that we would have to distribute all programs built with CLIB4 with the SOs in either PWD or PWD/sobjs.

I am assuming that it would be a bad idea to put any CLIB4 SOs into SOBJS: since that location should be kept for NEWLIB.

We could modify elf.library to check in SOBJS:clib4, but we would need to get elf.library to do that only when it knows that the binary was built with CLIB4.

We could implement RPATH in elf.library. That would mean that we would need to remember to apply that mechanism when linking the program. Or, we could implicitly do this always via changing ADTOOLS.

Any more options or ideas - other than the obvious and - my personal favourite - of linking statically, always!

clib4.library

Whether linking statically or dynamically, this is relevant. Unlike NEWLIB, CLIB4 is changing rapidly in relative terms. Either clib4.library is already resident, or it exists in LIBS:. We could force a transient modification to LIBS: to add the PWD to LIBS so that OpenLibrary would also check PWD in the case that a particular clib4.library is distributed.

3246251196 commented 1 week ago

Moved to Discussion section.

walkero-gr commented 1 week ago

About so and the library files, I was under the impression that the system always checks first the PWD and then the sys: drive. Isn't that the case?

Also, what happens when an app loads clib4.library from libs: and then another app loads it from its folder? I believe that since it is in memory, the second app will use this one and will not load it again, unless there is a restriction on the version.

migthymax commented 6 days ago

Anyone understanding the solution described by joerg ?

Is that the way to go? And if it was envisioned by the developer team, is there a official documentation?

afxgroup commented 5 days ago

since we have also an elf.library and our best gcc developer :smile: developer i still prefer the liveforit solution using const variable and patching elf.library

walkero-gr commented 5 days ago

@afxgroup You mean the following comment by liveforit?

attribute((used)) const char *os4_c_library = “clib4”; can be put into the link library and forgotten.

afxgroup commented 5 days ago

Yes