title: Can any one help me desipher this error that I am getting while trying to open a port with a dll
body: <p>Can any one help me desipher this error that I am getting while trying to open a port with a dll.  I am getting an erro: "Access violation at address 0003D078" When I call SAAT_Open(myCharPtrOpen). Not sure if I am defininig the Handle correctly on unit UntRFIDAPI.  Is the variable PHandle define correctly?
  Here is my code:</p>
  
  <pre><code>procedure TForm5.Button1Click(Sender: TObject);
   var
     myString, myString2  : string;
     myCharPtrInit: PChar;
     myCharPtrOpen: PChar;
     i : Integer;
     Open, Init: Boolean;
   begin
    // Create a string of Char's
    myString  := '&amp;hp';
    // Point to the first character in the string
    i := 1;
    myCharPtrInit := Addr(myString[i]);
    if SAAT_TCPInit(myCharPtrInit,'192.168.3.238',7086) = True then
    begin
      StatusBar1.Panels[0].Text := 'Initiated'; //ShowMessage('Initiated');
      myString2 := 'hp';
      myCharPtrOpen := Addr(myString2[i]);
      if SAAT_Open(myCharPtrOpen) = True then StatusBar1.Panels[1].Text := 'Opened';   
    end;
  end;
  
  
  unit UntRFIDAPI;
  
  INTERFACE
  uses
    SysUtils, Windows, Messages, Classes, Graphics, Controls, Dialogs,
    StdCtrls, Forms, DBCtrls, DB, Grids, DBGrids,Mask, ExtCtrls,
    Buttons, WinTypes;
  
  var
    A: String;
  
  function SAAT_TCPInit(pHandle: Pointer; pHostName: String; nsocketPort: Integer):Boolean; stdcall;
  function SAAT_Open(pHandle: Pointer):Boolean; stdcall;
  function SAAT_Close(pHandle: Pointer):Boolean; stdcall;
  
  implementation
  
  function SAAT_TCPInit;  external 'RFIDAPI.dll';
  function SAAT_Open;  external 'RFIDAPI.dll';
  function SAAT_Close;  external 'RFIDAPI.dll';
  
  end.
  </code></pre>
  
  <p>Here is the API call:</p>
  
  <p>1.1 Initialize Ethernet Port(TCP) connection </p>
  
  <pre><code>//TCP parameters initialization 
  //Functionality：import by parameter, initialize TCP to prepare for opening connection
  //Parameters： 
  //  pHandle for preserving the opening ports handl 
  //  pHostName reader IP address, only effective under the ethernet communication 
  //  nsocketPort network SOCKET port 
  //Returned value：true: Operation Succeeded, false Operation Failed 
  
  bool SAAT_TCPInit (void** pHandle,char *pHostName,int nsocketPort)
  </code></pre>
  
  <p>If the IP connecting to the reader is 192.168.0.238, port is 7086, then calling as follows: </p>
  
  <pre><code>HANDLE hp; 
  if (!SAAT_TCPInit(&amp;hp, ”192.168.0.238”, 7086)) 
  { 
      printf("reader initialization failed!\n"); 
      return false; 
  }
  </code></pre>