Olá a todos. Tenho uma DLL de uma placa de aquisição…gostaria de saber primeiro se alguém de vcs já implemetaram…se não…
queria saber se alguem tem algum software que testa a DLL…estou chamando a mesma do java mais só que esta dando erro nas funções…
se vcs pode me ajudar agradeço. o erro que esta dando na DLL… a DLL foi desenvolvida em VB6.
o meu codigo esta assim.desde já agradeço…galera.
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Platform;
/** Simple example of JNA interface mapping and usage. */
public class Main {
// This is the standard, stable way of mapping, which supports extensive
// customization and mapping of Java to native types.
public interface CLibrary extends Library {
CLibrary INSTANCE = (CLibrary) Native.loadLibrary((Platform.isWindows() ? "Easy_lab" : "c"),
CLibrary.class);
Integer SearchDevices(byte v1);
Integer SearchDevices();
Integer SetPWM(byte v1, byte v2, long v3);
int SetPWM();
Integer SetPortDirections(byte v1, long v2);
Integer GetPortDirections(byte v1, Integer v2);
Integer GetPortDirections();
Integer GetInPorts(byte v1, Integer v2);
Integer GetInPorts();
Integer GetOutPorts(byte v1, Integer v2);
Integer GetOutPorts();
Integer SetOutputPorts(byte v1, long v2); //Desligar as portas: de 0 a 511, que representa as 9 portas. Ex. Desligar todas as portas: ?SetOutputPorts(0)? , 0 decimal é igual ao binário: 000000000 (DIO9 a DIO0).
long Icen(byte v1, long v2);
long DoGetIcp(byte v2, long v1, long v3);
NativeLong DoGetIcp();
long ReadAdc(byte v1, byte v2, byte v3, byte v4, byte v5, long v6);
long ReadAdc();
long ReadAllAdc(byte v1, Object v2);
long ReadAllAdc();
long GetTemp(byte v1, Integer v2);
Long GetTemp();
}
public static void main(String[] args) {
byte v = 1;
byte v1 = 10;
byte v2 = 1;
byte v3 = 1;
byte v4 = 2;
long v5 = -25;
int v6 = 90;
//;;//System.out.println(CLibrary.INSTANCE.SearchDevices(v)+" as");
System.out.println(CLibrary.INSTANCE.SearchDevices() + " as");
for (int i = 0; i < args.length; i++) {
// CLibrary.INSTANCE.printf("Argument %d: %s\n", i, args[i]);
}
}
}
Meu erro esta assim
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x030118c3, pid=5932, tid=5996
#
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) Client VM (14.0-b16 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [jna8455273253319822365.dll+0x18c3]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- T H R E A D ---------------
Current thread (0x002b6800): JavaThread "main" [_thread_in_native, id=5996, stack(0x008c0000,0x00910000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x83ec8d89
Registers:
EAX=0x03084724, EBX=0x00000000, ECX=0x83ec8b55, EDX=0x02a73e68
ESP=0x0090f890, EBP=0x0090f8a8, ESI=0x00000000, EDI=0x0090f900
EIP=0x030118c3, EFLAGS=0x00010206
Top of Stack: (sp=0x0090f890)
0x0090f890: 03084724 02a73e68 02a73e6c 00000002
0x0090f8a0: 0090f8e0 00000000 0090fa00 03014773
0x0090f8b0: 0090fa90 03084724 0090faf4 0090f8d0
0x0090f8c0: 0090f8e0 0090f8e8 00000010 0301420c
0x0090f8d0: 00000006 00000004 22a06e10 030141ee
0x0090f8e0: 00000000 00000000 22a06e10 030141d5
0x0090f8f0: 002b6910 0090fb4c 6d8c040e 0090f96c
0x0090f900: 00918259 ffffffff ffffffff 00000010
Instructions: (pc=0x030118c3)
0x030118b3: 04 24 89 54 24 08 8b 15 60 62 02 03 89 54 24 04
0x030118c3: ff 91 34 02 00 00 c9 c3 90 8d 74 26 00 55 89 e5
Stack: [0x008c0000,0x00910000], sp=0x0090f890, free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [jna8455273253319822365.dll+0x18c3]
C [jna8455273253319822365.dll+0x4773]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.jna.Function.invokeInt(I[Ljava/lang/Object;)I+0
j com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;Z)Ljava/lang/Object;+315
j com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+214
j com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+341
j $Proxy0.SearchDevices()Ljava/lang/Integer;+9
j Main.main([Ljava/lang/String;)V+35
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x02ab9400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=6020, stack(0x02d30000,0x02d80000)]
0x02ab2c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=6016, stack(0x02ce0000,0x02d30000)]
0x02ab1800 JavaThread "Attach Listener" daemon [_thread_blocked, id=6012, stack(0x02c90000,0x02ce0000)]
0x02ab0000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4732, stack(0x02c40000,0x02c90000)]
0x02a71800 JavaThread "Finalizer" daemon [_thread_blocked, id=1960, stack(0x02bf0000,0x02c40000)]
0x02a6cc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=6004, stack(0x02ba0000,0x02bf0000)]
=>0x002b6800 JavaThread "main" [_thread_in_native, id=5996, stack(0x008c0000,0x00910000)]
Other Threads:
0x02a6b400 VMThread [stack: 0x02b50000,0x02ba0000] [id=6000]
0x02ad4c00 WatcherThread [stack: 0x02d80000,0x02dd0000] [id=5928]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 960K, used 553K [0x22990000, 0x22a90000, 0x22e70000)
eden space 896K, 54% used [0x22990000, 0x22a0a700, 0x22a70000)
from space 64K, 100% used [0x22a80000, 0x22a90000, 0x22a90000)
to space 64K, 0% used [0x22a70000, 0x22a70000, 0x22a80000)
tenured generation total 4096K, used 106K [0x22e70000, 0x23270000, 0x26990000)
the space 4096K, 2% used [0x22e70000, 0x22e8a878, 0x22e8aa00, 0x23270000)
compacting perm gen total 12288K, used 403K [0x26990000, 0x27590000, 0x2a990000)
the space 12288K, 3% used [0x26990000, 0x269f4e58, 0x269f5000, 0x27590000)
ro space 8192K, 67% used [0x2a990000, 0x2aef8d98, 0x2aef8e00, 0x2b190000)
rw space 12288K, 54% used [0x2b190000, 0x2b80d0f0, 0x2b80d200, 0x2bd90000)
Dynamic libraries:
0x00400000 - 0x00424000 C:\Arquivos de programas\Java\jdk1.6.0_14\bin\java.exe
0x7c900000 - 0x7c9b6000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c900000 C:\WINDOWS\system32\kernel32.dll
0x77f50000 - 0x77ffb000 C:\WINDOWS\system32\ADVAPI32.dll
0x77db0000 - 0x77e42000 C:\WINDOWS\system32\RPCRT4.dll
0x77f20000 - 0x77f31000 C:\WINDOWS\system32\Secur32.dll
0x7c340000 - 0x7c396000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\msvcr71.dll
0x6d8b0000 - 0x6db3b000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\client\jvm.dll
0x7e360000 - 0x7e3f1000 C:\WINDOWS\system32\USER32.dll
0x77e50000 - 0x77e99000 C:\WINDOWS\system32\GDI32.dll
0x76b20000 - 0x76b4e000 C:\WINDOWS\system32\WINMM.dll
0x76360000 - 0x7637d000 C:\WINDOWS\system32\IMM32.DLL
0x6d860000 - 0x6d86c000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\verify.dll
0x6d3e0000 - 0x6d3ff000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\java.dll
0x6d340000 - 0x6d348000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\hpi.dll
0x76bd0000 - 0x76bdb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d8a0000 - 0x6d8af000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\zip.dll
0x68000000 - 0x68036000 C:\WINDOWS\system32\rsaenh.dll
0x77bf0000 - 0x77c48000 C:\WINDOWS\system32\msvcrt.dll
0x769a0000 - 0x76a55000 C:\WINDOWS\system32\USERENV.dll
0x5bcb0000 - 0x5bd06000 C:\WINDOWS\system32\netapi32.dll
0x6d6c0000 - 0x6d6d3000 C:\Arquivos de programas\Java\jdk1.6.0_14\jre\bin\net.dll
0x71a70000 - 0x71a87000 C:\WINDOWS\system32\WS2_32.dll
0x71a60000 - 0x71a68000 C:\WINDOWS\system32\WS2HELP.dll
0x71a10000 - 0x71a50000 C:\WINDOWS\System32\mswsock.dll
0x76f00000 - 0x76f27000 C:\WINDOWS\system32\DNSAPI.dll
0x10000000 - 0x10018000 C:\Arquivos de programas\Kaspersky Lab\Kaspersky Internet Security 7.0\dnsq.dll
0x77ea0000 - 0x77f16000 C:\WINDOWS\system32\SHLWAPI.dll
0x76f90000 - 0x76f98000 C:\WINDOWS\System32\winrnr.dll
0x76f40000 - 0x76f6d000 C:\WINDOWS\system32\WLDAP32.dll
0x76fa0000 - 0x76fa6000 C:\WINDOWS\system32\rasadhlp.dll
0x03010000 - 0x03064000 C:\Documents and Settings\alex\Configurações locais\Temp\jna8455273253319822365.dll
0x03070000 - 0x0308d000 C:\WINDOWS\system32\Easy_lab.dll
0x77100000 - 0x7718b000 C:\WINDOWS\system32\oleaut32.dll
0x774c0000 - 0x775fd000 C:\WINDOWS\system32\ole32.dll
0x6e600000 - 0x6e610000 C:\WINDOWS\system32\libusb0.dll
0x74aa0000 - 0x74aa7000 C:\WINDOWS\system32\cfgmgr32.dll
0x77900000 - 0x779f5000 C:\WINDOWS\system32\setupapi.dll
0x63e40000 - 0x63e48000 C:\WINDOWS\system32\libusbvb0.dll
VM Arguments:
java_command: Main
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Arquivos de programas\MySQL\MySQL Server 5.0\bin;C:\Arquivos de programas\Java\jdk1.6.0_14\bin;C:\Arquivos de programas\Java\jdk1.6.0_14\lib;C:\Arquivos de programas\Java\jre6\bin;C:\Arquivos de programas\Java\jre6\lib
USERNAME=alex
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 76 Stepping 2, AuthenticAMD
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 3
CPU:total 1 (1 cores per cpu, 1 threads per core) family 15 model 76 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext
Memory: 4k page, physical 1964584k(1081492k free), swap 3903644k(3118448k free)
vm_info: Java HotSpot(TM) Client VM (14.0-b16) for windows-x86 JRE (1.6.0_14-b08), built on May 21 2009 08:03:56 by "java_re" with MS VC++ 7.1
time: Mon Feb 22 09:54:12 2010
elapsed time: 0 seconds