www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Runtime.loadLibrary() on Linux

reply "F i L" <witte2008 gmail.com> writes:
Is it possible?

I get a message "rt_loadLibrary() not supported on Posix" when I 
try. Is there something I'm doing wrong or is loading shared 
libraries not supported at all on Linux systems?

thanks.
May 10 2012
next sibling parent "F i L" <witte2008 gmail.com> writes:
I should not I've only tried with DMD (so far). I'll try with LDC 
and GDC in the morning.
May 10 2012
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-05-10 09:09, F i L wrote:
 Is it possible?

 I get a message "rt_loadLibrary() not supported on Posix" when I try. Is
 there something I'm doing wrong or is loading shared libraries not
 supported at all on Linux systems?

 thanks.

No, not using "rt_loadLibrary". You can still use the good old C function "dlopen". I think "rt_loadLibrary" does some extra stuff that the corresponding Windows function for "dlopen" doesn't do for shared D libraries. -- /Jacob Carlborg
May 10 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
On Thursday, 10 May 2012 at 11:11:14 UTC, Jacob Carlborg wrote:
 On 2012-05-10 09:09, F i L wrote:
 Is it possible?

 I get a message "rt_loadLibrary() not supported on Posix" when 
 I try. Is
 there something I'm doing wrong or is loading shared libraries 
 not
 supported at all on Linux systems?

 thanks.

No, not using "rt_loadLibrary". You can still use the good old C function "dlopen". I think "rt_loadLibrary" does some extra stuff that the corresponding Windows function for "dlopen" doesn't do for shared D libraries.

Ah, thank you. That set me on the right track.
May 10 2012
prev sibling next sibling parent reply "Sean Kelly" <sean invisibleduck.org> writes:
On Thursday, 10 May 2012 at 07:09:43 UTC, F i L wrote:
 Is it possible?

 I get a message "rt_loadLibrary() not supported on Posix" when 
 I try. Is there something I'm doing wrong or is loading shared 
 libraries not supported at all on Linux systems?

It should be made to work on Linux. Interested in submitting a pull request? The function is in src/rt/dmain2.d.
May 11 2012
parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> writes:
On 11-05-2012 20:46, Sean Kelly wrote:
 On Thursday, 10 May 2012 at 07:09:43 UTC, F i L wrote:
 Is it possible?

 I get a message "rt_loadLibrary() not supported on Posix" when I try.
 Is there something I'm doing wrong or is loading shared libraries not
 supported at all on Linux systems?

It should be made to work on Linux. Interested in submitting a pull request? The function is in src/rt/dmain2.d.

Isn't it just a matter of dlopen on most (if not all) POSIX impls? -- - Alex
May 11 2012
prev sibling parent "F i L" <witte2008 gmail.com> writes:
Sean Kelly wrote:
 It should be made to work on Linux.  Interested in submitting a
 pull request?  The function is in src/rt/dmain2.d.

alexrp beat me to it: https://github.com/D-Programming-Language/dmd/pull/941 https://github.com/D-Programming-Language/druntime/pull/211
May 11 2012