Function mapping Delphi DLL with Java (JNA) -
i'm having problems when trying use 2 functions of dll in delphi jna java. in test software (delphi, provided dll ), have functions (working in test software):
function abrir_conexao (const modelo : **byte**; const host : **pansichar**; const porta : **word**; const senha : **pansichar**) : integer; stdcall external 'comunicacao.dll'; function enviar_comando (const comando : **byte**; var tamanho : **byte**; var dados : **pbyte**) : integer; stdcall external 'comunicacao.dll';
i'm trying implement these functions in java (jna). i'm getting load dll , , believe problem lies in use of correct primitive variables:
public int abrir_conexao (**byte** modelo, **string** host, **short** porta, **string** senha); public int enviar_comando(**byte** comando, **byte** tamanho, **byte[]** dados);
but it's not working. can ?
for following native functions:
function abrir_conexao (const modelo : byte; const host : pansichar; const porta : word; const senha : pansichar) : integer; stdcall external 'comunicacao.dll'; function enviar_comando (const comando : byte; var tamanho : byte; var dados : pbyte) : integer; stdcall external 'comunicacao.dll';
jna mapping:
public interface mylibrary extends stdcalllibrary { mylibrary instance = (mylibrary)native.loadlibrary('comunicacao', mylibrary.class); int abrir_conexo(byte modelo, string host, short port, string senha); int enviar_comando(byte comando, byte tamanho, byte[] dados); }
Comments
Post a Comment