Thread overview | |||||
---|---|---|---|---|---|
|
January 14, 2011 Compiling a shared library | ||||
---|---|---|---|---|
| ||||
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 |
January 14, 2011 Re: Compiling a shared library | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mandeep Singh Brar | On Friday 14 January 2011 00:49:12 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.
I'm not sure what the exact state of shared libraries and dmd is at the moment, but as I understand it, it doesn't quite work right now. Getting shared libraries working will be one of the priorities once the 64-bit port of dmd is done, but until then, I don't believe that you can do it.
- Jonathan M Davis
|
January 14, 2011 Re: Compiling a shared library | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mandeep Singh Brar | 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 |
Copyright © 1999-2021 by the D Language Foundation