How to compile Phobos with other D code to create a shared library?

data pulverizer data.pulverizer at gmail.com
Mon May 31 20:41:17 UTC 2021


On Monday, 31 May 2021 at 20:32:11 UTC, kinke wrote:
> On Monday, 31 May 2021 at 19:21:52 UTC, data pulverizer wrote:
>> ldc2 jbasic.d -O3 -link-defaultlib-shared --betterC 
>> --boundscheck=off -nogc -shared -of=jbasic.so
>
> The problem is almost certainly `-betterC`, which disables 
> linking against Phobos and druntime.

Thanks - I should have know that one! I've removed the flag but 
now I'm getting the following error when I try to call the 
function:

```
Aborting from src/core/time.d(2131) 
MonoTimeImpl!(ClockType.normal) failed to get the frequency of 
the system's monotonic clock.
signal (6): Aborted
in expression starting at REPL[2]:1
gsignal at x86_64-linux-gnu/libc.so.6 (unknown line)
abort at x86_64-linux-gnu/libc.so.6 (unknown line)
_D4core8internal5abortQgFNbNiNfMAyaMQemZv at 
/lib64/libphobos2.so.0.90 (unknown line)
_D4core4time__T12MonoTimeImplVEQBdQBb9ClockTypei0ZQBj8currTimeFNbNdNiNeZSQCtQCr__TQCpVQCei0ZQCz at dmd/current/lib64/libphobos2.so.0.90 (unknown line)
_D3std6random13bootstrapSeedFNbNiZm at 
dmd/current/lib64/libphobos2.so.0.90 (unknown line)
_D3std6random__T17unpredictableSeedTmZQwFNbNdNiNeZm at 
dmd/current/lib64/libphobos2.so.0.90 (unknown line)
_D3std6random17unpredictableSeedFNbNdNiNeZk at 
dmd/current/lib64/libphobos2.so.0.90 (unknown line)

```


More information about the Digitalmars-d-learn mailing list