hksdk/CH-HCNetSDKV6.1.9.47_build2.../动态库加载说明.txt

46 lines
2.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

【库文件加载说明】
1. lib文件夹里面所有库文件libhcnetsdk.so、libHCCore.so、libssl.so.1.1、libcrypto.so.1.1以及HCNetSDKCom文件夹都需要加载到工程中。
2. HCNetSDKCom文件夹如果和libhcnetsdk.so、libhpr.so、libHCCore文件、可执行文件不在同级目录或者加载失败可以调用NET_DVR_SetSDKInitCfg(enumType类型赋值为2lpInBuff对应结构体NET_DVR_LOCAL_SDK_PATH)设置组件库所在路径。
3. libcrypto.so.1.1和libssl.so.1.1是开源库如果库文件加载失败可以调用NET_DVR_SetSDKInitCfg(enumType类型赋值为3lpInBuff对应libcrypto.so.1.1所在的路径字符串)、NET_DVR_SetSDKInitCfg(enumType类型赋值为4lpInBuff对应libssl.so.1.1所在的路径字符串)指定下这些库文件加载路径。
4. 如果库文件加载始终不成功初始化失败可以尝试将SDK所在路径添加到LD_LIBRARY_PATH环境变量中。
【路径设置的Java示例代码】
//这里是库的绝对路径,请根据实际情况修改,注意改路径必须有访问权限
//设置HCNetSDKCom组件库所在路径
String strPathCom = "/home/test/Desktop/JavaDemoLinux/lib";
HCNetSDK.NET_DVR_LOCAL_SDK_PATH struComPath = new HCNetSDK.NET_DVR_LOCAL_SDK_PATH();
System.arraycopy(strPathCom.getBytes(), 0, struComPath.sPath, 0, strPathCom.length());
struComPath.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(2, struComPath.getPointer());
//设置libcrypto.so所在路径
HCNetSDK.BYTE_ARRAY ptrByteArrayCrypto = new HCNetSDK.BYTE_ARRAY(256);
String strPathCrypto = "/home/test/Desktop/JavaDemoLinux/lib/libcrypto.so.1.1";
System.arraycopy(strPathCrypto.getBytes(), 0, ptrByteArrayCrypto.byValue, 0, strPathCrypto.length());
ptrByteArrayCrypto.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(3, ptrByteArrayCrypto.getPointer());
//设置libssl.so所在路径
HCNetSDK.BYTE_ARRAY ptrByteArraySsl = new HCNetSDK.BYTE_ARRAY(256);
String strPathSsl = "/home/test/Desktop/JavaDemoLinux/lib/libssl.so.1.1";
System.arraycopy(strPathSsl.getBytes(), 0, ptrByteArraySsl.byValue, 0, strPathSsl.length());
ptrByteArraySsl.write();
hCNetSDK.NET_DVR_SetSDKInitCfg(4, ptrByteArraySsl.getPointer());
【路径设置的C++示例代码】
char cryptoPath[2048] = {0};
sprintf(cryptoPath, "/home/test/Desktop/alarm_demo/libcrypto.so.1.1");
NET_DVR_SetSDKInitCfg(NET_SDK_INIT_CFG_LIBEAY_PATH, cryptoPath);
char sslPath[2048] = {0};
sprintf(sslPath, "/home/test/Desktop/alarm_demo/libssl.so.1.1");
NET_DVR_SetSDKInitCfg(NET_SDK_INIT_CFG_SSLEAY_PATH, sslPath);
NET_DVR_LOCAL_SDK_PATH struComPath = {0};
sprintf(struComPath.sPath, "/home/test/Desktop/alarm_demo"); //HCNetSDKCom文件夹所在的路径
NET_DVR_SetSDKInitCfg(NET_SDK_INIT_CFG_SDK_PATH, &struComPath);