Can I use .o files of compiled c files and use that to compile SV files for DPI

In reply to dave_59:

Thanks Dave,

So I have created shared object file .so using gcc. Now I need to call C function of shared object from SV file.

I have created import DPI-C of that function in .sv file

How to compile and link that .so file in Questasim?

vlib work
vlog -sv -l libshared_code.so tb_dpi.sv
vsim -c tb_dpi -do “run -all”

on compiling using above command I got error like
Failed to find user specified function ‘getRandom’ in DPI C/C++ source files.