First: the compiler itself does not matter but the RTL and FCL and the FPC packages should...be build with -Cg -Xc -XX -CX and maybe -Xs
Second: Why would you need Forms and Interfaces in a shared library? That is bad practice: It will pull in ALL code, since a shared library will never be able to distinguish what you need.
A simple shared library is a few KB on Linux. Add classes for some Pzazz and it is still under 1 MB. (867 KB on ARM-LINUX.Note it still pulls in ALL of classes)
The template for a shared library looks plainly stupid for Linux, but also in general.
Unfortunately I do not have simple libraries. Compare library size for a library that takes min. 200kB on Windows. What takes it on your Linux then?
Depends: between 253 K and 800K.
Make a proof.
library simple;{$CALLING C}uses initc; // this is actually needed for an so to make it callable from other languages.function AddMe(const a,b:integer):integer;begin AddMe := a+b;end;exports AddMe;beginend.
I interpreted it differently
That means the sizes should converge to a similar size with larger dynlibs. And that is what I see.