title: SystemVerilog: How to connect C function using DPI call in VCS simulator?
body: <p>I have the following files:</p>
  
  <p><strong>C file with functions:</strong></p>
  
  <p><strong>// funcs.c</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void something() {
      printf("something\n");
      sayHello();
  }
  </code></pre>
  
  <p><strong>System verilog file:</strong></p>
  
  <p><strong>// hello_world.v</strong></p>
  
  <pre><code>module kuku;
      export "DPI-C" function sayHello;
      import "DPI-C" function void something();
      initial something();
      function int sayHello ();
          $display("hello world");
          sayHello = 1;
      endfunction
  endmodule
  </code></pre>
  
  <p>How can I compile it and make this work so when I call <code>something()</code> from SV, it will call the C function, and when I call <code>sayHello()</code> from C, it will call the SV function?</p>