06-09-2009 04:20 AM
Hello,
I have made a DLL in visual c++ 2008.
The function declaration prottypes are defined as:
#define DLLTYPE void __declspec(dllexport)
#ifdef __cplusplus
extern "C" {
#endif
DLLTYPE RS232OpenPort(const char *Port, int* handle, int *iResult);
#ifdef __cplusplus
}
#endif
Calling the function in cvi always generates an General Protection Fault at address 6865A1C8.
The dll was tested succesfully in Visual c++ 2008.
Anyone has a solution for that?
06-11-2009 09:48 AM
Hi Danut81,
If this dll is written using c++ .NET, the problem may be that you are not using our .NET library. This post has more information on this possibility:
NI forums: CVI call to Managed C++ DLL causes 'General Protection' fault
If you are not using .NET, or this does not resolve your problem, please attach your dll and source so that I can attempt to replicate the issue.
06-12-2009 01:47 PM
By reading the post CVI call to Managed C++ DLL causes 'General Protection' fault I indentify the same issue on my DLL.
I was able to get rid of the anoing crash only by removing some calls from a DLL that was probably using some .NET assemblies (functionality).
Anyway this did not really solved my problem, only I was able to find the root cause. Dynamically loading the library works fine also in my case but this is not what I wanted.
By the way I'm using CVI 8.5