libphobos.so libdruntime.so

Marco Leise Marco.Leise at gmx.de
Thu Feb 2 17:29:20 PST 2012


As time goes by the D runtime will have it's place on Unix systems next to  
the C runtime. The upcoming support for PIC is the next step. Now I just  
want to quickly raise awareness for "sonames". For any library, there may  
be several incompatible versions installed, since new features are added  
and old features a deprecated. This happens in Phobos as well, no doubt  
:). So the solution is to put the version in the library name as well, so  
they can coexist in the same directory (/usr/lib).

Here is an example for the two versions of libunique I have installed:
	/usr/lib64/libunique-1.0.so         (link to  
/usr/lib64/libunique-1.0.so.0.100.6)
	/usr/lib64/libunique-1.0.so.0       (link to  
/usr/lib64/libunique-1.0.so.0.100.6)
	/usr/lib64/libunique-1.0.so.0.100.6
	/usr/lib64/libunique-3.0.so         (link to  
/usr/lib64/libunique-3.0.so.0.0.2)
	/usr/lib64/libunique-3.0.so.0       (link to  
/usr/lib64/libunique-3.0.so.0.0.2)
	/usr/lib64/libunique-3.0.so.0.0.2
As you can see there is actually the full version down to the tiniest  
minor version appended to the file name and several layers of coarser  
versioning. An application can now link against libunique-1.0.so to get  
the old API and /usr/lib64/libunique-3.0.so to get the new API.

The same has to happen with druntime and Phobos2 or otherwise our programs  
will break with every new release that deprecates or changes non-template  
functions. That would probably be *every* release at the moment, so it  
could look like this:
/usr/lib64/libphobos2.so     (link to /usr/lib64/libphobos2.so.060)
/usr/lib64/libphobos2.so.058
/usr/lib64/libphobos2.so.059
/usr/lib64/libphobos2.so.060
/usr/lib64/libdruntime.so     (link to /usr/lib64/libdruntime.so.060)
/usr/lib64/libdruntime.so.058
/usr/lib64/libdruntime.so.059
/usr/lib64/libdruntime.so.060

There are two steps involved in getting this out of the door now:
1) I'm not an expert with these things, but from the looks of it, I think  
the Makefile should handle appending the version string
2) The runtime should be downloadable as a separate package (like the  
famous MSVC Runtime Redistributables)
Developers have three choices then:
- static linking
- packaging the so/dll with their application (always using the  
tested-works version)
- use the system installation of druntime/Phobos2 (benefit from patches  
(as far as WinSxS doesn't intervene))

-- Marco


More information about the Digitalmars-d mailing list