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

**URL:** <https://verificationacademy.com/forums/t/can-i-use-o-files-of-compiled-c-files-and-use-that-to-compile-sv-files-for-dpi/30946>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, DPI, functions-in-system-verilog, Questa-104\
**Created:** [August 10, 2015, 12:05pm UTC](https://verificationacademy.com/forums/t/can-i-use-o-files-of-compiled-c-files-and-use-that-to-compile-sv-files-for-dpi/30946 "2015-08-10T12:05:45Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Ankit\_Patel](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/ankit_patel/32/1302_2.png) [@Ankit\_Patel](https://verificationacademy.com/forums/u/Ankit_Patel)\
**Post date:** [August 11, 2015, 10:53am UTC](https://verificationacademy.com/forums/t/can-i-use-o-files-of-compiled-c-files-and-use-that-to-compile-sv-files-for-dpi/30946/4 "2015-08-11T10:53:22Z")

</div>

_In reply to [Ankit\_Patel](https://verificationacademy.com/forums/t/can-i-use-o-files-of-compiled-c-files-and-use-that-to-compile-sv-files-for-dpi/30946/3):_

//Created shared library using below command  
gcc -shared -fPIC -Bsymbolic -o test.so test.c main.c

//Simulating shared library with Questasim  
vlib work  
vlog -sv tb\_dpi.sv  
vsim -sv\_lib test -c tb\_dpi -do “run -all”

//Created executable using below command  
gcc -o test test.so

Now problem here is my GUI sets some variable in test.c file but my systemverilog code dosen’t gets the updated value.  
I thing Questa dosen’t get’s updated from .so at runtime. So is there a way to run executable in Questasim so that sv code gets updated value or any other suggestions?

---

_[View the full topic](https://verificationacademy.com/forums/t/can-i-use-o-files-of-compiled-c-files-and-use-that-to-compile-sv-files-for-dpi/30946)._
