Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

using LabWindows with Visual C++, program going to LabWindows function instead of SDK func with same name

Hi!

I'm trying to use LabWindows with Visual C++. We mostly have it working properly, but have one problem. I want to use an SDK function that has the same name as a LabWindows function (Beep). When I call Beep with the SDK parameters, I get an error and the Visual C++ tells me I need LabWindows beep parameters. There are no LabWindows functions calls in the file. How can I get the Visual C++ compiler to use the SDK Beep and not the LabWindows Beep.

thanks,
Lorrie Smith
lorrie.smith@itt.com
0 Kudos
Message 1 of 4
(3,227 Views)
Are you #include'ing both the windows.h and CVI's utility.h header files? If so, could you just #include windows.h? I think that would solve the problem. If you're including windows.h and then utility.h, Beep is actually getting redefined to CVI_Beep due to the following code in utility.h:

#ifdef _NI_mswin32_
void CVIFUNC cviprefix(Beep) (void);
#define Beep cviprefix(Beep)
#else
void CVIFUNC Beep (void);
#endif

If you need to call the Win32 Beep, you'll need to #undef Beep before calling Beep.

- Elton
0 Kudos
Message 2 of 4
(3,227 Views)
Thanks, I'll give it a try.

Lorrie
0 Kudos
Message 3 of 4
(3,227 Views)
Lorrie,

There are a number of name conflicts between CVI functions and SDK functions. CVI usually handles those conflicts by redefining the function names in the CVI headers, so that when you include the CVI headers you get the CVI functions, without any compiler errors.
The problem you're having now is that you want to use the SDK version of the function. What you have to do in this case is to undo the redefinition that the CVI header file does.
To do that, find out where the CVI header file "utility.h" is being included in your source code, and then, following the include statement, type "#undef Beep"
That should allow the VC compiler to use the SDK prototype instead of CVI's.

Luis Gomes
NI
0 Kudos
Message 4 of 4
(3,227 Views)