Export DPI function question about the real type and realtime type

In reply to dave_59:

Hi Dave,

I have further question on this topic.

If I coded as below in SV side.


realtime time1;
realtime time2;
always @ (posedge clk) begin
    time1 <= $realtime;
    time2 <= time1;
end

export "DPI-C" function get_period;

function void get_period(output realtime rt);
    rt = (time1 - time2);
endfunction

And in Cplusplus side, how can I get the value rt ?

I coded as below but failed at compilation.
[c]
extern “C” void get_period(double &t);

double &t;
get_period(t);
[/c]