信息: LabVIEW: 2019版本: 19.0.1 (32位)操作系统: Windows 64位
Labview在无限期后完全崩溃。我调用C-DLL的三个函数。我一遍又一遍地循环DLL的所有功能。大约2分钟到1小时后,Labview无缘无故地崩溃。
OpenConnection()
的调用:
QueryOpenConnectionStatus()
的调用:
CloseConnection()
的调用:
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工作得很好。为此,我在Python、LabWindows/CVI、C++和Delphi中集成了DLL。在这些编程语言中没有崩溃!
有人能给我一些有用的建议吗?如何进一步隔离或消除错误。即使DLL的一个函数已经执行,然后DLL被关闭,它仍然会导致崩溃。好像它还在记忆里。感觉就像在干草堆里找针。
发布于 2022-03-02 16:31:18
在我的经验中,有时用LabVIEW调用的DLL会导致这种问题,并且没有具体的原因和解决方案(甚至对于NI技术支持也是如此)。尝试使用管理员特权启动LabVIEW应用程序。在某些情况下,这解决了问题。
https://stackoverflow.com/questions/71314338
复制相似问题