DMD started to support shared lib on linux from 2.063.
This may be useful: http://dlang.org/dll-linux.html
Also note that if you are only writting the shared lib and not the client, it would be easyier to bootstrap it using gcc's attributes (see http://stackoverflow.com/questions/9759880/automatically-executed-functions-when-loading-shared-libraries ). Else, there is a Runtime.loadLibrary (which will be improved later), to load and start a D shared library (if you just dlopen, static ctor & stuff won't be initialized).

Thanks, I guess I will have to go that route as my old trickery no longer works; I am building the client, so I'll now use Runtime.loadLibrary. However, http://dlang.org/dll-linux.html says I must link to libphobos.so and not libphobos.a suggesting that my old trickery could work as before by putting libphobos.a in its entirety into the client and none of it in a dynamic library. Yet it does not, as revealed immediately by the client's file size. Which suggests that http://dlang.org/dll-linux.html is out of date.

Can anyone tell me if http://dlang.org/dll-linux.html correct for 2.065 ?


All of this was a lot easier on Windows, where I was able to make everything work with no significant trouble.

Reply via email to