Hie,
Now It's OK !!
After submitting my problem to NI, NI has transmitted to me a simple program :
a VI which simply calls a function in a DLL (which loads an UIR), and their solution runs.
Their solution is the "same" as mine except in mine, I have added calls to "MessagePopup"
just to study how running my program like this (see "// Here ->x" ) :
Extract of my code in my DLL :
----------------------------------------------------------------------------------------
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
int iValue=0;
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
"// Here ->1" MessagePopup ("Avertissement", "DLL -> Init Ressources DLL LabWindows");
if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
break;
case DLL_PROCESS_DETACH:
"// Here ->2" MessagePopup ("Avertissement", "DLL -> Free Ressources DLL LabWindows");
if (!CVIRTEHasBeenDetached())
{
CloseCVIRTE ();
}
break;
}
....
----------------------------------------------------------------------------------------
The problem is located to the line "// Here ->"
When I drag the icon "Call Librairie function" in the diagram of my VI and I define parameters,
immediately a "link" is established between LabView and the DLL, the __stdcall DllMain is called !
then LabView Environnement failed !, you have then to kill the LabView Process !
By changing the "MessagePopup" functions with tracks (*) in a file, I can "debug" my program and I will
have never this artefacts.
(*) :
change line // Here ->1 with TraceMsg("DLL -> Init Ressources DLL LabWindows");
change line // Here ->2 with TraceMsg("DLL -> Free Ressources DLL LabWindows");
void TraceMsg(char *szBuffer)
{
int iValue=0;
int iHandle=0;
iHandle = OpenFile("D:\\Thierry\\Formation LabView-LabWindows\\trace.log",
VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII);
iValue = WriteLine (iHandle, szBuffer,strlen(szBuffer));
iValue =CloseFile (iHandle);
}
Thierry