Thread overview
gdc shared library build
Sep 05, 2014
Russel Winder
Sep 05, 2014
David Nadlinger
Sep 05, 2014
Russel Winder
Sep 05, 2014
Russel Winder
Sep 05, 2014
Johannes Pfau
Sep 05, 2014
ketmar
September 05, 2014
Iain,

I suspect I have failed to: a) remember something I should know; and b) discover something I should be able to find out from the webverse. However:

I am trying to create a shared library. I have DMD and LDC command lines that create a shared object without reporting errors (doesn't mean they work though). Sadly GDC isn't playing ball with:

gdc -o libthingy.so -shared file.o

it is trying to link to the static libphobos2.a which is clearly going to be a bit of a problem. Thus I have to specify forcing lookup in libphobos2.so. Is this easy?
-- 
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


September 05, 2014
On Friday, 5 September 2014 at 17:14:30 UTC, Russel Winder via Digitalmars-d wrote:
> I am trying to create a shared library. I have DMD and LDC command lines
> that create a shared object without reporting errors (doesn't mean they
> work though).

Huh? If there are any issues with LDC shared libraries, please take a moment to report them.

Thanks,
David
September 05, 2014
On Fri, 2014-09-05 at 17:16 +0000, David Nadlinger via Digitalmars-d wrote:
> On Friday, 5 September 2014 at 17:14:30 UTC, Russel Winder via Digitalmars-d wrote:
> > I am trying to create a shared library. I have DMD and LDC
> > command lines
> > that create a shared object without reporting errors (doesn't
> > mean they
> > work though).
> 
> Huh? If there are any issues with LDC shared libraries, please take a moment to report them.

Indeed. I am just trying to get SCons to build things properly at the moment. Checking things actually work comes next :-)

I do note that:

        dmd -of=library.so -shared -defaultlib=libphobos2.so code.o

works fine, but for ldc2 I have to have:

        ldc2 -of=library.so -shared -defaultlib=phobos2 code.o

for ldc2 to work. I am not sure if this is as it should be or if one of DMD and LDC is wrong.

-- 
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


September 05, 2014
On Fri, 2014-09-05 at 17:16 +0000, David Nadlinger via Digitalmars-d wrote:
> On Friday, 5 September 2014 at 17:14:30 UTC, Russel Winder via Digitalmars-d wrote:
> > I am trying to create a shared library. I have DMD and LDC
> > command lines
> > that create a shared object without reporting errors (doesn't
> > mean they
> > work though).
> 
> Huh? If there are any issues with LDC shared libraries, please take a moment to report them.

From my tinkerings, I cannot see any problems: DMD and LDC generated shared objects both behave as they should, which in this instance is to provide shared libraries with c linkage entry points usable from Python via ctypes of CFFI.

-- 
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


September 05, 2014
Am Fri, 05 Sep 2014 18:14:20 +0100
schrieb Russel Winder via Digitalmars-d <digitalmars-d@puremagic.com>:

>  Thus I have to specify forcing lookup in
> libphobos2.so. Is this easy?

This is the easy part, but you also need a libgphobos2.so first ;-)

As ketmar said this is not implemented in GDC yet. I've filed a pull request with some initial work, but I'm busy with other stuff right now so I can't finish it.

https://github.com/D-Programming-GDC/GDC/pull/83

Main issues remaining:

* Requires changes to binutils linker scripts to locate ModuleInfo. We
  need to decide whether we submit patches to binutils or try to find
  some other way (like in ldc or dmd).
* There are some unresolved bugs with PIC codegen, 2 test cases fail.
September 05, 2014
On Fri, 5 Sep 2014 20:04:46 +0200
Johannes Pfau via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> * There are some unresolved bugs with PIC codegen, 2 test cases fail.
and some more bugs i sent to Iain directly by e-mail. one related to PIC and one to optimizer which removes some necessary code. but i believe that those are minor issues that will be sorted out. otherwise it is almost working. ;-)