Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ViReal64 type

I'm trying to pass a variable of type ViReal64 back from VC++.NET code to
VB.NET code. If I return it simply by declaring the return type of the
function to be double, the results are not reliable- the digits are right
but they have the wrong power of 10.

If I declare the return type to be ViReal64, I still get "double" coming out
in VB. If I try passing back a pointer to a ViReal64 object, VB6 complains
that the return type of the function is not supported.

I've found the "toDouble" method of the ViReal64 object but am having
trouble figuring out how to use it. If I try returning "value.ToDouble" from
my function, I get the error

DMM3 error C3610: 'Double': value type must be 'boxed' before method
'ToDouble' can be called

I do not grea
tly understand this "__box" directive and have not been able to
get anywhere with it.

I notice CVI has functions for converting TO ViReal64, but not for
converting from.

Can anyone explain how to do this?

--
Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK. http://www.aail.co.uk/
0 Kudos
Message 1 of 3
(6,622 Views)
Could you please post a code sample that reproduces the behavior above? I tested this by creating a Managed C++ library with the code below:

#pragma once
#include "C:\VXIpnp\WinNT\include\visatype.h"

using namespace System;

namespace ViReal64Test
{
public __gc class Test
{
public:
Test()
{
}

System::Double GetReal64()
{
ViReal64 value = 123.45;
return value;
}
};
}

I called this code from VB.NET like this:

Dim t As ViReal64Test.Test = New ViReal64Test.Test
MessageBox.Show(t.GetReal64())

When I ran the VB.NET application, I got a message box that displayed 123.45 as expected. I changed the return type in the Managed C++ code from System::Double to V
iReal64 and got the same results.

How is the code above different from what you're doing? Does the example above help with your problem, or does this example not cover what you're trying to do? Thanks.

- Elton
0 Kudos
Message 2 of 3
(6,622 Views)
The problem turned out to be that the textbox I was displaying the final
result in was not wide enough to display the exponent.

There was much cursing when I realised.

--
Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK. http://www.aail.co.uk/

"Elton Wells" wrote in message
news:506500000005000000D80F0100-1042324653000@exchange.ni.com...
> Could you please post a code sample that reproduces the behavior
> above? I tested this by creating a Managed C++ library with the code
> below:
0 Kudos
Message 3 of 3
(6,622 Views)