![](/img/trans.png)
[英]Unhandled exception at 0x0F64F6E0 (ucrtbased.dll) in Assignment_SDD_Proj.exe: 0xC0000005: Access violation reading location 0x00000000
[英]LabVIEW + C-DLL: Access violation (0xC0000005) at EIP = 0x00000000
信息: LabVIEW:2019版本:19.0.1(32位)操作系統: Windows 64位
Labview 在不確定的時間后完全崩潰。 我調用了 C-DLL 的三個函數。 我一遍又一遍地循環遍歷 DLL 的所有功能。 大約 2 分鍾到一個小時后,Labview 無故崩潰。
調用QueryOpenConnectionStatus()
:
TConnectionResult
的類型定義
按照給定的Headerfile.h
#ifndef __epMCOMLib_h_
#define __epMCOMLib_h_
#include <stdint.h>
#include <stddef.h>
#define DLLIMPORT __declspec(dllimport)
#pragma pack (push,1)
typedef struct {
uint16_t DLLFailureCode;
uint8_t ConnectionStatus;
uint32_t SystemFailureCode;
} TConnectionResult;
#pragma pack (pop)
#ifdef __cplusplus
extern "C" {
#endif
DLLIMPORT uint16_t __cdecl OpenConnection(uint8_t PortType,
char * PortName,
uint32_t OnConnectSucces,
uint32_t * Handle);
DLLIMPORT void __cdecl QueryOpenConnectionStatus(uint32_t Handle,
TConnectionResult * Result);
DLLIMPORT uint16_t __cdecl CloseConnection(uint32_t Handle);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //#ifndef __epMCOMLib_h_
DLL 完美運行。 為此,我將 DLL 集成到Python、LabWindows/CVI、C++ 和 Delphi中。 這些編程語言沒有崩潰!
誰能給我任何關於如何進一步隔離或消除錯誤的有用提示。 即使執行了DLL中的一個function,然后關閉了DLL,仍然會導致崩潰。 好像還在memory。感覺大海撈針。
根據我的經驗,有時使用 LabVIEW 調用 DLL 會導致此類問題,並且沒有具體原因和解決方案(即使是 NI 技術支持)。 嘗試以管理員權限啟動您的 LabVIEW 應用程序。 在某些情況下,這可以解決問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.