Compiling a shared library

Mandeep Singh Brar mandeep at brars.co.in
Fri Jan 14 00:49:12 PST 2011


Hi,

I read on this website that it is possible to create shared libraries on linux using dmd. Is that
correct?
I am trying to compile the following code:

module testPlugin;
import std.stdio;

export class testPlugin {
	export void testMethod() {
		writeln("This is method from plugin");
	}
}

using the command
dmd -fPIC testPlugin.d -oflibtestplugin.so -L-shared

The system gives me the error

//usr/lib/libc_nonshared.a(elf-init.oS): relocation R_386_GOTOFF against undefined hidden symbol
`__init_array_end' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value

I tried to compile the file first with -c and then create a shared object but again it gives the same
message.

Can you please let me know if i am doing something wrong here or is it even possible to create a linux
shared library using dmd.

Regards
Mandeep


More information about the Digitalmars-d-learn mailing list