Neues Thema starten

TSE unter Linux / Lazarus bzw. Freepascal

Hallo zusammen,

 

hat einer von Euch schonmal versucht die TSE unter Lazarus/Freepascal auf Linux anzusteuern?

 

Ich versuche das aktuell für eine neue Software und hab bisher alles hinbekommen. Nun stoppt mich das worm_transaction_start.

 

Wenn ich es genau so versuche, wie mit Delphi erhalte ich Zugriffsverletzungen:

 

function worm_transaction_start(const context: WormContext; const clientId: PAnsiChar; const processData: PByte; processDataLength: UInt64; const processType: PAnsiChar; out response: WormTransactionResponse): WormError;
 cdecl; external 'libWormAPI.so';

 Mit PChar statt PAnsiChar natürlich genauso.


Mit PByte gibt es zumindest keine Zugriffsverletzung mehr, allerdings gibt mir die TSE dann immer "invalid parameter" zurück.

 

function worm_transaction_start(context: WormContext; const clientId: PByte; const processData: PByte;
  processDataLength: UInt64; const processType: PByte; out response: WormTransactionResponse): WormError;
  stdcall; external 'libWormAPI.so';

function TRWSwissbitTSE.TransactionStart(ClientID, Data, ProcessType: string): WormTransactionData;
var
  Response: WormTransactionResponse;
  rProcessData, rClientID, rProcessType: PByte;
  ProcessLength: UInt64;
begin
  try
    Getmem(rProcessData, 0);
    Getmem(rClientID, Length(ClientID));
    Getmem(rProcessType, 0);//Length(ProcessType));
    rClientID := PByte(ClientID);
    ProcessLength := 0;

    Response := 0;
    Response := worm_transaction_response_new(pTSE);
    if Response = 0 then
      raise Exception.Create('worm_transaction_response_new failed');
    pWormError := worm_transaction_start(pTSE, rClientID, rProcessData, ProcessLength, rProcessType, Response);
    CheckForWormError;
    worm_transaction_response_free(Response);

    Freemem(rProcessData);
    Freemem(rClientID);
    Freemem(rProcessType);
  except
    on E: Exception do
      raise Exception.Create('TRWSwissbitTSE.TransactionStart: ' + E.Message);
  end;
end;

 Ich vermute mein Fehler liegt darun wie ich das PByte fülle. Eventuell kann mir ja einer von euch weiterhelfen. 

Anmelden oder Registrieren um einen Kommentar zu veröffentlichen