www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Could DRuntime be implemented as a shared library?

reply solidstate1991 <laszloszeremi outlook.com> writes:
Offloading at least the GC could enable the implementation of a 
per-application GC easier, as well as making development of 
shared libraries under Windows much easier, might even enable the 
offloading of Phobos into its own DLL.

As an outsider, I think the biggest problem would be from the 
templates (if any) used in the runtime library on the 
implementation side. On the other hand we could just still 
implement those as a static library into the executable files.

Versioning would be the hardest, we either release a new one with 
each new implementation, or develop the runtime library more 
independently from the compiler with clever versioning, however 
it might cause the development of the DRuntime to be fragmented 
for supporting older and newer versions.
May 31
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 31/05/2017 4:57 PM, solidstate1991 wrote:
 Offloading at least the GC could enable the implementation of a 
 per-application GC easier, as well as making development of shared 
 libraries under Windows much easier, might even enable the offloading of 
 Phobos into its own DLL.
Won't work, TypeInfo doesn't cross the shared library boundary atm. This is probably the real blocker for shared libs on Windows (includes Phobos as a DLL). The GC can be swapped out already at runtime, just need shared libs to be working properly :)
 As an outsider, I think the biggest problem would be from the templates 
 (if any) used in the runtime library on the implementation side. On the 
 other hand we could just still implement those as a static library into 
 the executable files.
 
 Versioning would be the hardest, we either release a new one with each 
 new implementation, or develop the runtime library more independently 
 from the compiler with clever versioning, however it might cause the 
 development of the DRuntime to be fragmented for supporting older and 
 newer versions.
We already do all this, on Linux (and I think OSX too) Phobos+druntime is built as a shared library by default.
May 31
next sibling parent reply solidstate1991 <laszloszeremi outlook.com> writes:
 Won't work, TypeInfo doesn't cross the shared library boundary 
 atm. This is probably the real blocker for shared libs on 
 Windows (includes Phobos as a DLL).

 The GC can be swapped out already at runtime, just need shared 
 libs to be working properly :)
Where can I read more about this TypeInfo issue? In July I'll have a bit more free time, maybe I can help with it.
 We already do all this, on Linux (and I think OSX too) 
 Phobos+druntime is built as a shared library by default.
I knew that under Linux Phobos is a shared library, I didn't know about the rest.
May 31
parent Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Wednesday, 31 May 2017 at 19:58:44 UTC, solidstate1991 wrote:
 Won't work, TypeInfo doesn't cross the shared library boundary 
 atm. This is probably the real blocker for shared libs on 
 Windows (includes Phobos as a DLL).

 The GC can be swapped out already at runtime, just need shared 
 libs to be working properly :)
Where can I read more about this TypeInfo issue? In July I'll have a bit more free time, maybe I can help with it.
 We already do all this, on Linux (and I think OSX too) 
 Phobos+druntime is built as a shared library by default.
I knew that under Linux Phobos is a shared library, I didn't know about the rest.
I'd suggest starting with Benjamin Thaut's DConf 2016 talk https://www.youtube.com/watch?v=MQRHxI2SrYM
May 31
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2017-05-31 18:02, rikki cattermole wrote:

 We already do all this, on Linux (and I think OSX too) Phobos+druntime
 is built as a shared library by default.
Not on macOS. -- /Jacob Carlborg
Jun 01