SV (DPI) - Return a struct?

A

Amal

Guest
I know the return type for a DPI functon is limited to the following:

byte, shortint, int, longint, real, shortreal, chandle, string,
Scalar values of type bit and logic

But is it possible to return a struct using a chandle (a void pointer
to that struct)?

Regards,
-- Amal
 
On Mar 30, 3:57 pm, Amal <akhailt...@gmail.com> wrote:
I know the return type for a DPI functon is limited to the following:

  byte, shortint, int, longint, real, shortreal, chandle, string,
Scalar values of type bit and logic

But is it possible to return a struct using a chandle (a void pointer
to that struct)?
Sure, but the SystemVerilog code cannot access that struct using the
chandle. The only things it can do with it are assign it or compare
it to another chandle, or pass it to another DPI call, which can then
use it to access the struct. A chandle is just a way for one DPI
routine to communicate a C pointer to another DPI routine by passing
it through SV. It is opaque to the SV code.
 

Welcome to EDABoard.com

Sponsor

Back
Top