title: Returning a string from a BPL function
body: <p>have a function, simplified below, that is exported from a BPL</p>
  
  <pre><code>function DoA(amount: currency; var Info: string): Currency; stdcall;
   begin
    result := amount * 19;
    Info:= 'Some Text about the result';
   end;
  </code></pre>
  
  <p>its loaded from the main program with LoadPackage, and GetProcAddress which works fine for the other functions.
  but this one brings up many errors when its called;</p>
  
  <p>BPL Is used with (simplified)</p>
  
  <pre><code>  bplhandle: HModule;
    BPLDoA: function (amount: currency; var Info: string): Currency; stdcall;
    intoStr : string;
  </code></pre>
  
  <p>.</p>
  
  <pre><code> begin
    bplhandle:=LoadPackage('test.bpl');
     if bplhandle &lt;&gt; 0 then
      begin
       @BPLDoA:=GetProcAddress(bplhandle,'DoA');
         if assigned(BPLDoA) then
         result := BPLDoA(123, intoStr);
      end;
   end;
  </code></pre>
  
  <p>the exception that seems to happen at the end of the Procedure,
  but the corrected text is returned into intoStr (viewed with a break point)</p>
  
  <p>would the error have anything to do with the Info param being a var and/or a string? </p>
  
  <p>The Error message is</p>
  
  <blockquote>
    <p>Project Project1.exe raised exception class EInvalidPointer with message 'Invalid pointer operation'</p>
  </blockquote>
  
  <p>thanks</p>
  
  <p>more info>
  another function from the same bpl/unit works fine</p>
  
  <pre><code>function DoB(amount: currency): Currency; stdcall;
    result := amount * 19;
   end;
  </code></pre>
  
  <p>Mad Except></p>
  
  <blockquote>
    <p>exception class   : EInvalidPointer
    exception message : Invalid pointer operation.</p>
    
    <p>main thread ($1b7c):
    0040276f +013 Project1.exe System             @FreeMem
    00404650 +01c Project1.exe System             @LStrClr
    00483814 +15c Project1.exe Unit1       97 +11 TForm1.Button3Click
    00462430 +064 Project1.exe Controls           TControl.Click
    0045a870 +01c Project1.exe StdCtrls           TButton.Click</p>
  </blockquote>