LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI2015 IDE Application Hang on Exit

Solved!
Go to solution

Hi,

 

The CVI2015 IDE sometimes hangs on exit. I'm still trying to figure out when.

 

Meanwhile I can give you the event data that's recorded by the event log:

0000: 43 00 72 00 6F 00 73 00   C.r.o.s.
0008: 73 00 2D 00 74 00 68 00   s.-.t.h.
0010: 72 00 65 00 61 00 64 00   r.e.a.d.
0018: 00 00 00 00               ....

Maybe this is of help.

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 1 of 6
(5,095 Views)

Hi, CVI-User

 

Can you provide the entire event log entry? We will need more context for the data here.

Are you able to cause this hang by following a specific series of actions before closing LabWindows/CVI?

 

Thanks,

Daniel Dorroh
National Instruments
0 Kudos
Message 2 of 6
(5,075 Views)

So, after some experimenting a hang is caused by the source code browser not being able to cope with:

#include <windows.h>

static HINSTANCE DLLHandle;

static BOOL (__stdcall *F_Ptr)(BOOL on);

static int LoadDLLIfNeeded(void)
{
  F_Ptr = (BOOL (__stdcall *)(BOOL on)) GetProcAddress(DLLHandle, "F"));
    goto FunctionNotFoundError;

  return 0;

FunctionNotFoundError:
  return -1;
}

The IDE hangs on exit as soon as you add a file with this code to a project.

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 3 of 6
(4,867 Views)
Solution
Accepted by topic author CVI-User

Hello CVI-User!

 

I managed to reproduce the bug and identify the cause of this hang. It seems the LabWindows/CVI 2015 ADE hangs while trying to generate browsing information for the call to GetProcAddress. The main problem is the construct containing the function pointer cast.

Fortunately, there's an easy workaround for this issue: use typedef wrappers when casting function call results to function pointers. In your case:

typedef BOOL (__stdcall *FunctionType)(BOOL on);

static FunctionType F_Ptr;

static int LoadDLLIfNeeded(void)

{

  F_Ptr = (FunctionType)GetProcAddress(DLLHandle, "F");

  ...

 

This workaround not only prevents CVI from hanging, but also ensures a good practice for writing cleaner and easier to maintain code.

 

Meanwhile, CAR #543277 has been filed, to ensure this bug will be considered for fixing in an upcoming release of LabWindows/CVI.

I hope this helps!

 

Best regards!

- Johannes

Message 4 of 6
(4,853 Views)

Thanks alot, Johannes!

 

This seems to resolve all the hangs I had.

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 5 of 6
(4,842 Views)

Hi CVI-User!

 

The issue described by CAR #543277 has been addressed by the LabWindows/CVI 2015 SP1. Other information on bug fixes for this update can be found at: http://www.ni.com/product-documentation/53302/en/

 

Thanks,

- Johannes

0 Kudos
Message 6 of 6
(3,480 Views)