www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - MonoTimeImpl!(ClockType.normal) failed to get the frequency of the

reply Jack <jckj33 gmail.com> writes:
I have this D code base that when I compile to executable, it ran 
fine, but when I call the very same function from C, I get this 
error:

Aborting from src/core/time.d(2113) 
MonoTimeImpl!(ClockType.normal) failed to get the frequency of 
the system's monotonic clock.

from source code[1] I see ticksPerSecond failed to get a value 
but how don't know why and how can I fix that? can I track the 
line of code calling that function that end up with abort() call?
my OS is openSUSE Leap 15.0, DMD64 D Compiler v2.094.2, DUB 
version 1.23.0, built on Nov 20 2020


[1]:https://github.com/dlang/druntime/blob/fd5f4e2dded204b01d977c695c3ff910a699bc52/src/core/time.d#2113
Dec 13 2020
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
Did you initialize the D runtime before you called the D code? (assuming 
C main).
Dec 13 2020
parent Jack <jckj33 gmail.com> writes:
On Sunday, 13 December 2020 at 17:34:26 UTC, rikki cattermole 
wrote:
 Did you initialize the D runtime before you called the D code? 
 (assuming C main).
wow, thanks for such quck response. That's exactly what I missing in this function: version(Posix) { import core.runtime : rt_init, rt_term; rt_init(); scope(exit) rt_term(); } thanks!
Dec 13 2020