www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - libphobos2.so insists on its name while using shared libraries

I am using DMD 2.066.1 on Ubuntu 14.04 64-bit.

I used the latest main.d and dll.d codes from 
http://dlang.org/dll-linux.html

Then I used the following make file:

all:
	cp /usr/lib/x86_64-linux-gnu/libphobos2.so ./libmyphobos2.so

	dmd -c dll.d -fPIC
	dmd -oflibdll.so dll.o -shared -defaultlib=libmyphobos2.so 
-L-rpath=.

	dmd -c main.d
	dmd main.o -L-ldl -defaultlib=libmyphobos2.so -L-rpath=.

clear:
	rm -f *.so
	rm -f *.o


Since the "defaultlib" flag of dmd takes a shared library file 
name, and not a keywork as only "libphobos", I thought that if I 
copy my libphobos2.so to active folder with a new name, it should 
be alright. (Please notice I use libmyphobos2.so while compiling, 
and not libphobos2.so.)

---

Then I opened elementary OS Freya 64-bit on Virtual Box, and 
copied libdll.so, libmyphobos2.so, and main files to a folder, 
and set the executable bit of main.

Finally I executed ./main

Result is this:
./main: error while loading shared libraries: libphobos2.so.0.66: 
cannot open shared object file: No such file or directory.

---

The asking library is not even just "libphobos2.so" but with its 
version. Is this completely hard coded somewhere or something?
Nov 08 2014