@magorium
I haven't looked in IPC or other forms that can be used, so I won't comment on this part.
That is ok. Just saying that if someone out there would feel inclined to do so one could add a generic platform independent shared lib for IPC communication and add to axrt or simply use it from their individual AROS application(s).
You mentioned you asses Ax is intertwined with GCC - what do you mean by this? Can you given an example?
Sure thing :-)
Albeit that said, atm it is hypothetical based on what i've read in the readme/docs and source-code of axrt.
In case you are able to remember, it is similar to the situation you helped me with when linking against static aros libraries (in opposite to the normal way of doing things with FPC, namely opening/closing the shared libraries manually from disk and FPC assigning the library entry points in order to make API calls).
If i look at your distribution calculators example's makefile, i read:
# axrt.ld needs to be added to list of objects passed to linker for proper section ordering
# axrt.specs needs to be used for default libraries selection
That means i need to use a custom linker script. That should be doable for Free Pascal.
Then there is "the library selection", that links the libraries... ok, i have no idea right now but, let's assume i am able to do such a thing with FPC.
Then, i downloaded the deb file libaxrt-2.0-dev_40.2-1_amd64.deb and extracted the readme which reads, in chapter 4 (How do I build an application using runtime?):
4.3) Detailed - Linking
i.) Add startup.o and axrt.ld to objects being linked, example:
OBJ += /usr/lib/x86_64-linux-gnu/startup.o /usr/lib/x86_64-linux-gnu/axrt.ld
ii.) Select axrt.specs linker specs file, example:
LDFLAGS = -specs=/usr/lib/x86_64-linux-gnu/axrt.specs
iii.) Add additional linker libraries to resolve symbols, example:
-lmui -lamiga -lstdc.static -lstdc -lcodesets -lkeymap -lexpansion -lcommodities
-ldiskfont -lasl -lmuimaster -ldatatypes -lcybergraphics -lworkbench -licon
-lintuition -lgadtools -llayers -liffparse -lgraphics -llocale -ldos
-lutility -lexec -lm
So, i need to add startup.o (same as the static linking solution back then as mentioned at the beginning of this part of my reply).
Let's take a look at the startup file in your tree (
https://github.com/deadw00d/AROS/blob/5f70d1d7564124c0370855e921a256651a078e5f/arch/all-runtime/axrt/startup/startup.c)
In the first part afaik, i see there the same symbols that needs to be defined/exported in my Pascal source, according to my wishes. Note, that when i do so
i have already given control over from FPC startup code to AROS startup code, meaning that if anything goes wrong FPC is not able to catch it, c does but that does not help me in particular :-)
Then, i go further down and i see some other (for me) terrifying startup code, this time on/for the Linux side :shivers:
I have no idea what this line of code does:
const char dl_loader[] __attribute__((section(".interp"))) = "/lib64/ld-linux-x86-64.so.2"
But assuming that it defines a variable for the linker to pick up, and the fact that it points to ld (and even more because it seems a static location) sounds horrifying to me.
Assuming that my code is still alive, then we see a function named __runtimestartup, that sets and runtime environment and kickstarts and seems to be invoked from routine _axrt_start, that routine seems to be resolved by the linker and automagically invoked ?
.. and finally we arrive at open64, which also seems to be invoked due to some linker magic ?
Every time the linker matches the symbols that get called automagically, i literally have lost control over to the c runtime library (whatever runtime library
that is, be it AROS or linux-host. referred by me as "gcc intertwined"). And that is assuming that everything linked as intended. If not then it is for me a needle in the proverbial haystack to find out what went wrong where exactly (and why).
That is, if i all interpreted the documentation and source-code correctly.
And then there is the question of the axrt.so file. I can load and open it, but is there anything else that needs to be done from my side of things ? e.g. usually one opens a library and calls a (specific) function in order to initialize things properly.
Does that answer the question that you've asked ?