www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - compile x64 .dll and .so without dependencies

reply novice2 <sorryno em.ail> writes:
It there any recipe to compile x64 .dll without dependencies?

I mean it shoud be used without installing things like 
msvcr120.dll.
Dependencies on system dll (advapi32.dll, kerner32.dll) is ok.

I don't experiment on linux yet. But interest too.
Mar 04 2023
parent reply Guillaume Piolat <first.last spam.org> writes:
On Sunday, 5 March 2023 at 06:36:05 UTC, novice2 wrote:
 It there any recipe to compile x64 .dll without dependencies?

 I mean it shoud be used without installing things like 
 msvcr120.dll.
 Dependencies on system dll (advapi32.dll, kerner32.dll) is ok.

 I don't experiment on linux yet. But interest too.
What we do here in dub.json, for no deps on big 3 desktop OSes: "targetType": "dynamicLibrary", "dflags-linux-dmd": ["-defaultlib=libphobos2.a"], "dflags-osx-ldc": ["-static"], "dflags-linux-ldc": ["-link-defaultlib-shared=false"], "dflags-linux-x86_64-ldc": ["-fvisibility=hidden"], "dflags-windows-ldc": ["-mscrtlib=libcmt","-fvisibility=hidden", "-link-defaultlib-shared=false"], Additionally on (Windows + DUB + LDC), you will need to set an envvar: DFLAGS=-fvisibility=hidden -dllimport=none else you may still depend upon a dynamic phobos. It's unfortunate situation for such a common requirement...
Mar 05 2023
parent novice2 <sorryno em.ail> writes:
On Sunday, 5 March 2023 at 18:35:58 UTC, Guillaume Piolat wrote:
     "targetType": "dynamicLibrary",
     "dflags-linux-dmd": ["-defaultlib=libphobos2.a"],
     "dflags-osx-ldc": ["-static"],
     "dflags-linux-ldc": ["-link-defaultlib-shared=false"],
     "dflags-linux-x86_64-ldc": ["-fvisibility=hidden"],
     "dflags-windows-ldc": 
 ["-mscrtlib=libcmt","-fvisibility=hidden", 
 "-link-defaultlib-shared=false"],

 Additionally on (Windows + DUB + LDC), you will need to set an 
 envvar:
 DFLAGS=-fvisibility=hidden -dllimport=none
Thank you!
Mar 05 2023