www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Shared objects aka dynamic libraries

reply Russel Winder <russel winder.org.uk> writes:
I appear to be unable to use Google the last couple of days :-( so I
admit defeat, expose my current ignorance, hopefully to quickly become
enlightened.

Is it possible to easily with DMD, LDC and/or GDC create shared objects
aka dynamic libraries from a D code base?

Currently for me DMD and LDC refuse to accept the existence of a -shared
flag, and GDC always fails with some deeply incomprehensible messages
about not finding _tls.* functions.

There should be a page better than  http://dlang.org/dll-linux.html

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Jan 21 2014
next sibling parent reply "Dicebot" <public dicebot.lv> writes:
Yes, support is relatively solid for DMD/Linux : 
http://forum.dlang.org/post/minijortxmmyshyfniby forum.dlang.org

Don't use Windows but it is said to be much more complicated 
there. For LDC/GDC support is not yet ready AFAIK.
Jan 21 2014
parent reply Russel Winder <russel winder.org.uk> writes:
On Tue, 2014-01-21 at 15:59 +0000, Dicebot wrote:
 Yes, support is relatively solid for DMD/Linux : 
 http://forum.dlang.org/post/minijortxmmyshyfniby forum.dlang.org
Hummm…. it seems that DMD still tries to search libphobos2.a by default instead of libphobos2.so, so the -defaultlib=libphobos2.so is the difference between success and failure :-(
 Don't use Windows but it is said to be much more complicated 
 there. For LDC/GDC support is not yet ready AFAIK.
I'll have to get my wife's Windows 7 machine out to test all the D tool changes I am making. It is a real shame that anyone actually uses Windows for anything :-) -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Jan 21 2014
next sibling parent "Dicebot" <public dicebot.lv> writes:
On Tuesday, 21 January 2014 at 17:53:38 UTC, Russel Winder wrote:
 Hummm…. it seems that DMD still tries to search libphobos2.a by 
 default
 instead of libphobos2.so, so the -defaultlib=libphobos2.so is 
 the
 difference between success and failure :-(
As far as I understand shared one will become default only full stack of D utilities for working with loaded libraries will be available in runtime (right now you need to resort to dlsym) and tested a bit. Right now it is kind of semi-official.
Jan 21 2014
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2014-01-21 18:53, Russel Winder wrote:

 I'll have to get my wife's Windows 7 machine out to test all the D tool
 changes I am making. It is a real shame that anyone actually uses
 Windows for anything :-)
DMD works quite well with Wine, what I've heard. But that might not be reliable enough. -- /Jacob Carlborg
Jan 21 2014
prev sibling parent reply "Kagamin" <spam here.lot> writes:
On Tuesday, 21 January 2014 at 17:53:38 UTC, Russel Winder wrote:
 I'll have to get my wife's Windows 7 machine out to test all 
 the D tool
 changes I am making. It is a real shame that anyone actually 
 uses
 Windows for anything :-)
It's linux users, who use linux. Windows users don't use windows for anything, they use software running on windows, lol.
Jan 23 2014
parent "Dicebot" <public dicebot.lv> writes:
On Thursday, 23 January 2014 at 19:40:42 UTC, Kagamin wrote:
 On Tuesday, 21 January 2014 at 17:53:38 UTC, Russel Winder It's 
 linux users, who use linux. Windows users don't use windows for 
 anything, they use software running on windows, lol.
It awesome how this statement can be read as both linux flaw and merit depending on who reads it :)
Jan 23 2014
prev sibling parent "Mineko" <uminekorox gmail.com> writes:
On Tuesday, 21 January 2014 at 14:19:51 UTC, Russel Winder wrote:
 I appear to be unable to use Google the last couple of days :-( 
 so I
 admit defeat, expose my current ignorance, hopefully to quickly 
 become
 enlightened.

 Is it possible to easily with DMD, LDC and/or GDC create shared 
 objects
 aka dynamic libraries from a D code base?

 Currently for me DMD and LDC refuse to accept the existence of 
 a -shared
 flag, and GDC always fails with some deeply incomprehensible 
 messages
 about not finding _tls.* functions.

 There should be a page better than  
 http://dlang.org/dll-linux.html
I'm making a game engine using shared objects as scripts, take a look at https://github.com/ICGCC/Breaker-Engine You should also check out my fork, which is a little more recent. Point in case, look at src/breaker/util/core.d and you'll see what you need to do. Oh, than and shared objects only REALLY work with DMD and linux atm, windows is dodgy, and I've tested it.
Jan 23 2014