LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

function panel editor doesn't support pointer to numeric type

Solved!
Go to solution

Am I missing something or is it true that the CVI function panel editor doesn't support the specification of a parameter type as pointer to numeric type?

 

I can't think of any reason why it would not or should not.  It supports pointer to char.  And it supports an array name (which, in C, is a pointer to the first element of the array).

 

I suppose I could use the array form as a pointer, but surely this is confusing when dealing with a simple pointer to a scalar numeric type.

 

I'm using the function panel editor solely for the purpose of creating a type dictionary so I can invoke DLL functions from VB.  Is there information somewhere as to how CVI types might map to VB types when using the type dictionary?   e.g. what happens if I use an unsigned int in a function parameter (VB doesn't support unsigned ints) ?

 

 

Menchar

 

 

Message Edited by menchar on 02-09-2009 11:41 AM
Message Edited by menchar on 02-09-2009 11:41 AM
0 Kudos
Message 1 of 4
(3,456 Views)
Solution
Accepted by topic author menchar

Hi Menchar,

 

To create a pointer to an integer as a parameter on a function panel, you have a couple of different options.

 

First, all output parameters are set as pointers by default.  So if you create an output parameter of type 'int', it creates an 'int *' parameter.

Second, if you want it to show up in the input list, you can create a data type in CVI that will show up at the bottom of the list.  To edit your data types, go to Options»Data Types (you must have a Function Panel editor tab open and selected for this option to be available).  Enter the name of the type (in this case "int *") and click the Add button.  The new "int *" option should now show up at the bottom of the list.

Third, you could use the array form (int []), but as you said, that may be confusing to other people looking at the code.  Either of the first two options are better choices.

 

 

 As for your second question, here is a link to a MSDN page showing the types in Visual Basic and their .NET representations: http://msdn.microsoft.com/en-us/library/47zceaw7(VS.80).aspx.  This can be used to make a comparison between ANSI C and VB data types.  For example, you were asking about unsigned ints, and this site shows that Visual Basic has an Integer type (-2,147,483,648 through 2,147,483,64), and an unsigned counterpart, UInteger (0 through 4,294,967,295).  From what I can tell, Visual Basic has unsigned versions of all of its numeric representations.  You can then take that with a listing of ANSI C data types to convert between the two.  A listing of ANSI C data types can be found here: http://www.exforsys.com/tutorials/c-language/c-programming-language-data-types.html

Eric B.
National Instruments
0 Kudos
Message 2 of 4
(3,422 Views)

Thanks for the reply.  I got confused by the output type offering a type of "double" for example, instead of "double *" and hadn't noticed it in the text box as using the pointer type.

 

As for the type mapping, maybe VB.net has unsigned numeric types, but legacy VB does not.    It seems the types in the two lnguages are what they are, and there's no glue code of any kind at work that attempts to map different types in some meaningful way in the type dictionary?

 

Menchar

0 Kudos
Message 3 of 4
(3,416 Views)
I don't believe CVI has any conversion functions like that, but VBA does: http://support.microsoft.com/kb/189323 .  Looks like you can convert from unsigned numbers to numbers that can be used in VB.  I haven't tried this myself, but it should be what you are looking for.
Message Edited by Eric B. on 02-10-2009 03:08 PM
Eric B.
National Instruments
0 Kudos
Message 4 of 4
(3,412 Views)