02-10-2017 08:08 AM
I am recompiling an existing CVI project in CVI2015 as part of a move from XP to Win7, and as it is a 64bit Win7 I am also moving from 32bit to 64bit.
All the dll's and .exe bulid OK with no errors.
But when I come to run the top level GUI, a debug .exe file, I get FATAL RUN TIME ERROR found pointer to int expected pointer to __int64.
Should the compiler have fixed this for me?
The variable in question is &hWnd which is declared as an int and passed to GetPanelAttribute.
I assumed the same code should build either 32 or 64.
Is there something I am missing?
David
Solved! Go to Solution.
03-20-2017 11:02 AM
Window handles are 32-bit values in a 32-bit program and 64-bit values in a 64-bit program. You should declare it as an intptr_t, which will be correct for both bitnesses
The compiler can usually catch these types of errors, but in this case I'm assuming that you are passing it to GetPanelAttribute, in which case the compiler can't catch this since this function declares that parameter as a void * (since that function is used to get attributes of different types). Therefore, you have to pick the correct data type for the attribute that you're using. If you use the wrong type, the debugger will report the error that you saw.
03-20-2017 03:02 PM
Thanks for the clear explanation of why the compiler can not fix this one.