Closed MikePopoloski closed 1 year ago
Seeing some type mismatches errors for this.
slangtest97.sv:10:34: error: value of type 'dynamic array of byte' cannot be assigned to type 'unpacked array [] of byte'
P::write_buf("file.txt", write_buffer);
^~~~~~~~~~~~
package P;
import "DPI-C" context function int write_buf(string outfile, byte write_buf[]);
endpackage
class C;
function main();
int rc;
byte write_buffer[];
P::write_buf("file.txt", write_buffer);
endfunction
endclass
Ah, I did not realize dynamic arrays were still allowed here, but upon closer reading of the LRM they're only disallowed in DPI exports, not imports. I will fix.
Should be fixed now.
Ah, interesting -- I'll need to go through the LRM more. I didn't include the read_buff function in the first example because I assumed it was just the same issue. At least VCS/Questa are compiling the following code, but I've only tested runtime sim functionality in VCS.
slangtest98.sv:10:40: error: value of type 'unpacked array [] of byte' cannot be assigned to type 'dynamic array of byte'
rc = P::read_buf("input.data", read_buffer);
^~~~~~~~~~~
package P;
import "DPI-C" context function int read_buf(string outfile, output byte buffer[]);
endpackage
class C;
function main();
int rc;
byte read_buffer[];
rc = P::read_buf("input.data", read_buffer);
endfunction
endclass
Yeah, I overlooked output parameter handling. The conversion goes in the opposite direction.
Should be fixed for output args.
This has been added.