On 2011-01-14 09:49, Mandeep Singh Brar wrote:
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

You cannot currently do that with dmd on linux. The runtime doesn't have support for it and the are one or several PIC bugs that have to be fixed first. Issues 3226 and 4583 for example.

--
/Jacob Carlborg

Reply via email to