title: Send a String parameter from vfp 9 to a dll created on delphi 2007
body: <p>I'm trying <strong>to use Delphi's DLL from Visual FoxPro 9 by passing string from VFP</strong> to Delphi's DLL.  The Foxpro Crashes once I run the VFP code. My string values are under 254 characters.</p>
  
  <p>Including  ShareMem in delphi's code does not make any difference. It seems like the wrong string type is being used and I really don't know other types of string to code.</p>
  
  <p>Please help me with an example on how to pass string.</p>
  
  <p>The dll code works fine within Delphi.</p>
  
  <p><strong>in delphi's DLL...</strong></p>
  
  <hr>
  
  <pre><code>library dll_examp_With_PARA;
  
  uses
    ShareMem,
    SysUtils,
    Classes,
    Dialogs;
  
  {$R *.res}
  
  function showValues(var a:shortstring):shortstring; stdcall; export;
  
    begin
       Result:=('you passed ' + a);
    end;
  
    exports showValues;
  end.
  </code></pre>
  
  <p><strong>in VFP.....</strong></p>
  
  <hr>
  
  <pre><code>CLEAR ALL
  
  LOCAL vfpString as String
  
  DECLARE STRING showValues IN dll_examp_With_PARA.dll STRING 
  
  vfpString = 'Hello World!'
  
      ? showValues(vfpString)
  
      CLEAR ALL
  </code></pre>