Thanks for your kindly reply, I describe my question more clearly as below.
module SIM_FUNC();
import "DPI-C" function chandle malloc(input int unsigned size);
import "DPI-C" function void C_FUNC(output int unsigned static_Buff[256],
output chandle Hdl_Buff);
int unsigned static_Buff [256];
chandle Hdl_Buff;
initial begin
Hdl_Buff = malloc(512);
C_FUNC(static_Buff, Hdl_Buff);
end
endmodule:SIM_FUNC
==============================================================
void
C_FUNC(unsigned int* pStatic_Buff
void** pHdl_Buff)
{
unsigned int* ptC_Buff; // In C system, pointer's bits only 32
ptC_Buff = pStatic_Buff;
printf("First data pStatic_Buff = %2x\n", pStatic_Buff[0]); // It'ok, program ran smoothly
printf("First data C_Buff = %2x\n", ptC_Buff[0]); // when program step this, it always gets segmentation fault
//printf("[C_printf] SV_Addr = 0x%16lx, C_Addr = 0x%16lx \n", pStatic_Buff, ptC_Buff);
//printf("[C_printf] Addr = %16lx\n", pHdl_Buff);
}
=================================================================
When I ran SIM_FUNC simulation with C_FUNC, it got segmentation fault.
After printf message,
[C_printf] SV_Addr = 0x2aad532c4000, C_Addr = 0x532c4000
It was easy to find that the buffer pointer(pStatic_Buff) at SIM_FUNC was 64 bit-width base, but in C_FUNC, ptC_Buff was declared as 32 bit-width. so C can’t identify ptC_Buff0.
In my C code, I have developed programs for 32 bit-width pointer. I would like to know if SV’s pointer could be as 32-bitwidth.