LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

function prototype

hi,
There is a function prototype like this:
  double FtoC(double DegF, double *DegC);
how to build another function prototypes that must return other types such as: array , string , cluster and so on?
  e.g: double [ ] FtoC(double DegF, double *DegC);
As i know, we can use the Application Builder to make a FtoC.dll  after building the subVI FtoC.vi, this is just return a duble data.However, how to make the subVI FtoC.vi when i should return a array?  *_*
Besides,Who can give me the process or send me some examples about how to make subVI?
 
thanks!
 
0 Kudos
Message 1 of 7
(3,708 Views)

When you create a dll with the LabVIEW app builder, you can have as many functions as you just by adding additional top level VIs. Each one of these will have a different name. So, if you have created a VI called FtoC, create another called FtoCArray, add it to the soruce files when building the dll. When built, your dll will have two functions - FtoC and FtoCArray. If your VI has an array input and an array output, you function prototype would be something like "void FtoCArray(double f[], long len, double c[], long len2)".

A subVI is no different than any top level VI. You just have to make sure that the front panel controls and indicators are wired to the VI's connector pane.

0 Kudos
Message 2 of 7
(3,690 Views)
thanks for your help!
 
I just want to make the function prototype return double array or other types not only void type. There are some parameters in my function, including a input array and a, b,c etc. And the function should return an array that is identical with the output array in subVI, All the functions could be called in c/c++.
The function prototype is as follows: 
   double [ ] FtoCArray(double input[ ], long len,int a, int b, int c,boolean f ...); 
 how can solve this?
 
thanks!
regards
0 Kudos
Message 3 of 7
(3,662 Views)
I'm afraid I don't quite understand what you are asking. As far as I know, whe you create a dll with the LabVIEW app builder, the return parameter is always type void and cannot be changed. If however, you want to build a LabVIEW VI into a dll that will output something (array, double, string, whatever), then you can do that. Why does the function prototype have to be something specific?
0 Kudos
Message 4 of 7
(3,645 Views)
hi,
In fact,I just want to call LabVIEW from C/C++.
The following function prototype is called by it.  SubVI( HandleByVI.vi) in LabVIEW handle the input array from c/c++, and return the computed result  to the c/c++ side.
  double [ ]  HandleByVI(double input[ ], long len, String s,int i,...); //the input array is from c or c++,the function should return an array
If i don't need do it like above,how can i solve the problem in my program? Is it necessary  for me to rectify my SubVI?
thanks!
regards!
0 Kudos
Message 5 of 7
(3,620 Views)
I'm getting really confused by your postings. You keep mentioning different function prototypes. When you create a dll from LabVIEW, the function prototype is defined then and there. You have some flexibility in the order of the parameters and what you may or may not include. When you call the dll in c/c++, it has to match what you have created. It might be helpful for you to attach an image of the Define VI Prototype screen and the actual VI that you are trying to build into a dll.
0 Kudos
Message 6 of 7
(3,609 Views)
I think I get his question...
He wants to make a C call which returns a pointer to Y[] in the form Y=HandleByVI(&input,len,&charbuff[0], i...).
The labview define VI Prototype window doesn't allow pointers to be returned, only output values. which may be selected in the VI output dropbox.
What you really want is status=HandleByVI (double* input, double*output, long len, char* s...) and let status = success or failure of the function.
Wire up your inputs and outputs to the icon as you would for any subvi and they will be available when you select the Export VIs in the builder.
Cheers!
David
Ain't English just wunderful!
0 Kudos
Message 7 of 7
(3,220 Views)