title: Error in reading value from SV in C++ function using DPI
body: <p>I am trying to pass a string from SV to C++ function but the value is not getting passed properly to C++ function</p>
  
  <p>Code in SV side:</p>
  
  <pre><code>    import "DPI" function string mainsha(string str);
      class scoreboard ;
       string text_i_cplus;
       string text_o_cplus; 
      text_i_cplus="abc";
      text_o_cplus=mainsha(text_i_cplus);
  </code></pre>
  
  <p>That's how I am sending value to C++ . At the C++ side I am taking value as:</p>
  
  <pre><code>    extern "C" string mainsha(string input)
   {
  
      string output1 = sha256(input);
  
      cout &lt;&lt; "sha256('"&lt;&lt; input &lt;&lt; "'):" &lt;&lt; output1 &lt;&lt; endl;
     return output1;
   }
  </code></pre>
  
  <p>I am getting correct output when I running the C++ prog alone. But at the console I am getting the following output:</p>
  
  <blockquote>
    <p>sha256(''):e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855</p>
  </blockquote>
  
  <p>Can someone please suggest where I am going wrong or am I missing something?</p>