title: Passing PChar from Delphi DLL to C
body: <p>I am currently having trouble importing a Delphi DLL dynamically.
  The Delphi DLL function is declared as here :</p>
  
  <pre><code>function TEST() : PChar; cdecl;
  begin
    Result := '321 Test 123';
  end;
  </code></pre>
  
  <p>In C++ I am calling it this way:</p>
  
  <pre><code>typedef char *TestFunc(void);
  TestFunc* Function;
  HINSTANCE hInstLibrary = LoadLibrary("Test.dll");
  if (hInstLibrary)
  {
      Function = (TestFunc*)GetProcAddress(hInstLibrary, "TEST");
      if (Function)
      {
          printf("%s", Function());
      }
  }
  </code></pre>
  
  <p>The problem is that I am only receiving the first letter of the string.
  How can I tell C++ that the string is not ending after the first char?</p>
  
  <p>Thanks</p>