LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

#define, doubles and typlib

I have developed an IVI-C driver in LabWindows 2009. I have the option to include the typlib in the Dll, selected. In the h file for the driver there are several #defines that have floating point values. Using these values in the CVI source code works just fine.

 

If I create a VB6 example and reference the Dll I can use these values but they are humungous values - obviously not correct. If I use Oleview and look at the typlib in the Dll the values are correct. If I use the Object browser in VB6 I can see that all the floating point #define values are equal to "blank" (nothing I guess).

 

Anybody have any idea what's going on?

 

I have looked at sveral of the class driver h files and notice for the #define declarations they are all integers but they are using a syntax like this:

 

#define xyz  (2L)   <- I assume L means long. Is there a similar syntax for doubles? I am just declaring my floating point values like so:

 

#define abc  0.1

 

 

0 Kudos
Message 1 of 3
(3,142 Views)
Yes, the "L" in that define makes the value a long integer. You can append an "F" to a number (no spaces something like: 2.0F) and that will force it to be a float but I don't recall (and have not been able to find online) any way to force the value to be a double.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 3
(3,126 Views)

Now that I think about it (and I double checked it in a program) you can apply a type cast to a constant.

 

So try something like this:

 

#define DOUBLE_CONST {(double) 1234}

 

Maybe that will get you the result you want but I have no VB experience so I can't confirm that.

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 3 of 3
(3,125 Views)