Bind D as a shared lib for ldc

Prasun Anand via digitalmars-d-ldc digitalmars-d-ldc at
Tue Jul 25 23:53:36 PDT 2017


I would like to bind D as a shared library so that I can call it 
Ruby using FFI .

I found out how to do it with DMD from this 

But how should I so I do it with LDC?

I tried the example from above post and get the following error:

$ ldc2 -shared -m64 -relocation-model=pic i.d
/home/prasun/ldclatest/ldc-1.1.0-pk9rkm4zvdp6pglam7s2/lib/libdruntime-ldc.a(errno.c.o): relocation R_X86_64_PC32 against undefined symbol `__errno_location@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Error: /usr/lib/nvidia-cuda-toolkit/bin/gcc failed with status: 1


More information about the digitalmars-d-ldc mailing list