Can we use systemverilog DPI to interactive with "complex" C/C++ code?

Hi, Dear All,

I am thinking if we could leverage DPI to access “complex” C/C++ code. I knew basically how to use the DPI to invoke C/C++ in SV or vice versa. However, let us say if we have a C++ function as following :

int calc(vector<double> intput_A, vector<double> input_B){
  // ......
}

We all know there don’t have a available SV type which could be used to map C++ type “vector”, I called this kind of function as “complex” C/C++ function, do we have any method to use it via DPI ?

Another question, is following method possible ?

If we could define another C/C++ function, let it to invoke the wrap function inside C/C++, and it wasn’t “complex” format, i.e. no “complex” variable type.

int wrap(){
  vector <double> A;
  vector <double> B;
  // ......
 
  calc(A, B)
}

Does it work ? Really appreciate any comment.

In reply to caowangyang:

The IEEE 1800-2012 SystemVerilog standard only specifies a “DPI-C” interface. With the exception of types containing pointers, any type in C is representable in SystemVerilog. Some vendors have implemented experimental “DPI-SC” and “DPI-C++” interfaces. You will need to contact your vendor for specific details.