D: How would one make a shared dynamically linked D library?

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Nov 8 11:55:02 UTC 2023


Currently stick to ldc.

Dub's defaults will "just work" except:

- On *nix where you have to either set/patch the ``RPATH`` or set 
``LD_LIBRARY_PATH``.
- For executables on Windows in which you need to set the dflag 
``-dllimport=all``.


 From a README of mine (for Posix):


To get the loading of sidero shared libraries you will need to set the 
LD path before execution.

E.g. export 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/projects/ProjectSidero/eventloop/examples/networking

or you can patch the binary:

patchelf --force-rpath --set-rpath 
~/projects/ProjectSidero/eventloop/examples/networking ./example_networking


More information about the Digitalmars-d-learn mailing list