Java stürzt ab, wenn die DLL-Funktion mit JNA @ aufgerufen wi

Ich verwende JNA, um eine DLL-Funktion auszuführen:

Hier ist der gesamte Code, der dieser Art entspricht:

The Native Declarations:

//how the method declared

H264_Login (char *sIP, unsigned short wPort, char *sUserName, char *sPassword, LP_DEVICEINFO lpDeviceInfo, int *error, ,SocketStyle socketTyle=TCPSOCKET); // where LP_DEVICEINFO is a struct

//how the struct declared
typedef struct _H264_DVR_DEVICEINFO
{
    SDK_SYSTEM_TIME tmBuildTime; // the "SDK_SYSTEM_TIME" is another struct
    char sSerialNumber[64];      
    int byChanNum;          
    unsigned int uiDeviceRunTime;  
    SDK_DeviceType deviceTye; // the "SDK_DeviceType" is a enum
}H264_DVR_DEVICEINFO,*LP_DEVICEINFO;

// this is how "SDK_SYSTEM_TIME" is defined
typedef struct SDK_SYSTEM_TIME{
    int  year;  
    int  month;  
    int  day;  
}SDK_SYSTEM_TIME;

// this is how "SDK_DeviceType" is defined
enum SDK_DeviceType
{
    SDK_DEVICE_TYPE_DVR,
    SDK_DEVICE_TYPE_MVR,
    SDK_DEVICE_TYPE_NR
};

// this is how "SocketStyle" is defined
enum SocketStyle
{
    TCPSOCKET=0,
    UDPSOCKET,
    SOCKETNR
};

Das Folgende ist ihreentsprechende Java-Zuordnungen:

public class Test implements StdCallLibrary {
public interface simpleDLL extends StdCallLibrary {

 long H264_Login(String sIP, short wPort, String sUserName, String sPassword,
 Structure DeviceDate, int error, int TCPSOCKET);
}
static
{
   System.loadLibrary("NetSdk");
}

// the struct implementation
    public static class DeviceDate extends Structure{

        public SDK_SYSTEM_TIME tmBuildTime;
        public String sSerialNumber;      
        public IntByReference byChanNum;              
        public IntByReference uiDeviceRunTime;  
        public IntByReference deviceTpye;    
        @Override
        protected List<Object> getFieldOrder() {
            List<Object> list = new ArrayList<>();
            list.add("tmBuildTime");
            list.add("sSerialNumber");
            list.add("byChanNum");
            list.add("uiDeviceRunTime");
            list.add("deviceTpye");
            return list;
        }    
    }

    public static class SDK_SYSTEM_TIME extends Structure{
        public IntByReference year;  
        public IntByReference month;  
        public IntByReference day;
        @Override
        protected List<Object> getFieldOrder() {
            List<Object> list = new ArrayList<>();
            list.add("year");
            list.add("month");
            list.add("day");
            return list;
        }
    }

// and then how I called it through the main function
public static void main(String args[]) throws FileNotFoundException{

 simpleDLL INSTANCE = (simpleDLL) Native.loadLibrary( ("NetSdk"), simpleDLL.class);
 DeviceDate dev = new DeviceDate() // where DeviceDate is a static class inherits com.sun.jna.Structure
 int err = (int) INSTANCE.H264_GetLastError();

 long result = INSTANCE.H264_Login("255.255.255.255", (short) 33333, "admin", "admin", dev, err, 0);

}
}

eim Ausführen der App stürzt Java ab:

und das ist das volle Problem Signatur:

Problemunterschrift:
Problem Event Name: APPCRASH
Anwendungsname: javaw.exe
Application Version: 7.0.600.19
Anwendungszeitstempel: 536a95c6
Fehler Modulname: jna3976113557901128571.dll
Fault Module Version: 4.0.0.215
Fault Module Timestamp: 52d3949a
Ausnahmecode: c0000005
Exception Offset: 0000e3a2 OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 7bc2
Additional Information 2: 7bc24d73a5063367529b81d28aecc01c
Additional Information 3: 5bea
Additional Information 4: 5beaa1c0441c3adb156a170a61c93d19

Lesen Sie unsere Datenschutzerklärung online
http: //go.microsoft.com/fwlink/? linkid = 104288 & clcid = 0x0409

Wenn die Online-Datenschutzerklärung nicht verfügbar ist, lesen Sie unsere Datenschutzerklärung bitte offline: C: \ Windows \ system32 \ en-US \ erofflps.txt

Antworten auf die Frage(2)

Ihre Antwort auf die Frage