Ok. But check the ELF ident with readelf/elfdump to check that the binaries generated are really match the (major) version that you use.
I don't know these tools, but I think it does.
$ readelf -h libtags.so
ELF Header:
Magic: 7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: FreeBSD
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices x86-64
Version: 0x1
Entry point address: 0
Start of program headers: 64 (bytes into file)
Start of section headers: 1556016 (bytes into file)
Flags: 0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 5
Size of section headers: 64 (bytes)
Number of section headers: 29
Section header string table index: 28
$ file libtags.so
libtags.so: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, for FreeBSD 14.2, stripped
$ uname -v
FreeBSD 14.2-RELEASE-p1 GENERIC
Also you may add this at begin of code:
Sadly, this did not help.
Where is cwstring in your uses section?
Do you absolutely need cwstring?
You may replace WideString with PChar or AnsiString.
I don't want cwstring and I am not using it directly in my code (though if I do that instead, the end result is the same). I am using some other code which pulls LazUtils, which pull LazUtf8, which pulls cwstring. I tried replacing it with fpwidestring directly in lazarus source (based on information found in this non-English thread:
https://doublecmd.h1n.ru/viewtopic.php?t=3323), but it did not help. So I think there may be some other unit included somewhere which pulls some unit which forces clib, as I did not find more cwstring occurences in lazarus code.
Edit: Actually, I just repeated the modification of lazarus code to replace cwstring with fpwidestring and it works now. Not sure why it did not work before, maybe not everything got cleaned before build. So I guess I can compile it now, but it's a pain... since I think I have to modify lazarus source back to cwstring for normal programs. Unless I can maybe put a compiler directive there to detect shared libraries? Anyway, doublecmd plugins compiled after that change still crash the program with Bus error.