Quantcast
Channel: GUJ - Tópicos com a tag java
Viewing all articles
Browse latest Browse all 17410

[RESOLVIDO] Passagem de Array de Structure para uma dll (JNA)

$
0
0

@lazaru escreveu:

Boa tarde necessito passar passar um Array de structure segue códigos.

public class PW_GetData extends Structure {
        public static class ByReference extends PW_GetData implements 
                                                Structure.ByReference {}  
        public short wIdentificador = 0;
        public byte bTipoDeDado     = 0;
        public byte[] szPrompt      = new byte[84];
        public byte bNumOpcoesMenu  = 0;
        public byte[][] vszTextoMenu = new byte[20][41];
}

declaração da dll....

short PW_iExecTransac(PW_GetData[] pw_Data, IntByReference piNumParam);

passando parâmetro

IntByReference tam = new IntByReference(10);
PGWebLib.PW_GetData.ByReference[] pw_Data = new PGWebLib.PW_GetData.ByReference[10];
for (int i=0;i<10;i++){
    pw_Data[i] = new PGWebLib.PW_GetData.ByReference();
}
ret = INSTANCE.PW_iExecTransac(pw_Data, tam);

Erro:

Caused by: java.lang.IllegalArgumentException: Function PW_iExecTransac declared Structure[] at parameter 0 but array of class br.com.load.dll.meu.deus.loaddll.PGWebLib$PW_GetData$ByReference was passed
at com.sun.jna.Function.convertArgument(Function.java:580)
at com.sun.jna.Function.invoke(Function.java:305)
at com.sun.jna.Library$Handler.invoke(Library.java:236)
at com.sun.proxy.$Proxy5.PW_iExecTransac(Unknown Source)
at br.com.load.dll.meu.deus.loaddll.FXMLController.handleButtonAction(FXMLController.java:78)
... 58 more

Alguém tem alguma ideia?

Mensagens: 3

Participantes: 2

Ler tópico completo


Viewing all articles
Browse latest Browse all 17410

Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>