Program size, linking matter, and static this()

Marco Leise Marco.Leise at gmx.de
Tue Dec 20 12:51:39 PST 2011


Am 19.12.2011, 20:43 Uhr, schrieb Jacob Carlborg <doob at me.com>:

> It could be useful for a package manager. Theoretically all installed  
> packages could share the same dynamic library. But I would guess the the  
> packages would depend on different versions of the library and the  
> package manager would end up installing a whole bunch of different  
> versions of the Phobos and druntime.

No! Let's please try to get closer to something that works with package  
managers than the situation on Windows.

On Windows I see few applications that install libraries separately,  
unless they started on Linux or the libraries are established like  
DirectX. In the past DLLs from newly installed programs used to overwrite  
existing DLLs. IIRC the DLLs were then checked for their versions by  
installers, so they are never downgraded, but that still broke some  
applications with library updates that changed the API. Starting with  
Vista, there is the winsxs difrectory that - as I understand it - keeps a  
copy of every version of every dll associated to the programs that  
installed/use them.

Package managers are close to my ideal world:
- different API versions (major revisions) can be installed in parallel
- applications link to the API version they were designed for
- bug fixes replace the old DLL for the whole system, all applications  
benefit
- RAM is shared between applications that use the same DLL

I'd think it would be bad to make cuts here. If you cannot even imagine an  
operating system with 1000 little apps like type/cat, cp/copy, sed etc...  
written in D, because they would all link statically against the runtime  
and cause major bloat, then that is turning off another few % of C users  
and purists. You don't drive an off-road car, because you go off-roads so  
often, but because you could imagine it. (Please buy small cars for city  
use.)

Linking against different library versions goes in practice like this:
There is at least one version installed, maybe libphobos2.so.1.057. The 1  
would be a major revision (one where hard deprecations occur), then there  
is a link named libphobos2.so.1 to that file, that all applications using  
API version 1 link against. So the actual file can be updated to  
libphobos2.so.1.058 without recompiles or breakage.


More information about the Digitalmars-d mailing list