Using D without libphobos

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 26 03:14:39 UTC 2018


On 4/25/18 11:04 PM, A. Nicholi wrote:
> Hello,
> 
> I am working on a large cross-platform project, which will be written 
> primarily in D, interfacing to C as necessary. To get finer control over 
> memory safety, binary size, and use of the GC, we would like to disclude 
> libphobos as a dependency in lieu of our own code. The project is 
> compiled using LDC.
> 
> I am not sure if this is possible though, as it seems there are certain 
> things in libphobos that are tightly coupled into the D runtime. There 
> are several things in the core namespace that would be helpful for us 
> (SIMD, C bindings, etc), but I am not sure if that is not also part of 
> libphobos along with the other namespaces.
> 
> How do I remove libphobos as a runtime dependency with ld and MSVC’s 
> link.exe? Is it possible to decouple core from other parts of the 
> runtime, and if so, how?
> 
> Regards,
> A. Nicholi

It sounds like you want to simply link against druntime and not phobos.

In many cases, phobos and druntime are bundled together as a static 
library. If you just want druntime (core and rt) then you probably have 
to build druntime from source.

I'm generally working on dmd, so I don't know how it works for ldc. But 
I'm sure it's quite similar (building druntime with dmd is just one make 
command).

-Steve


More information about the Digitalmars-d mailing list