lpassion Posted June 18, 2006 Report Share Posted June 18, 2006 hi There is a problem in my current work. I just want to use a VI in LabVIEW for computing, that is use a VI to handle some data including array, int, Boolean, ect. The following VI has shown the process of my work. Please look at it. The VI of Butterworth Filter(BF) is used to handle the data, which are denoted by Input, samlingFreqFs,lowCutoffFreqFl,Order. All of the parameters from c or java. We can use App Builder to build a function prototype after the VI be made, and the prototype is shown as follows: //the Input array is disposed by BF //samplingFreqFs, lowCutoffFreqFl, Order are the properties of the BF void ButterWorthFilter(double samplingFreqFs, double lowCutoffFreqFl, double Input[], double Order, TD1Hdl *Output, long len) Then I build the VI in to dll file that is convenient to call by c or java! The above works have finished. However, I don Quote Link to comment
bsvingen Posted June 19, 2006 Report Share Posted June 19, 2006 I see that you are using LV 8.0.1 When building a DLL in the project builder you have full control over all data. Make sure you choose C calling. I tried your filter, and my header file automatically made by the project bulder looks like (the default, i didn't do any changes): #include "extcode.h"#pragma pack(push)#pragma pack(1)#ifdef __cplusplusextern "C" {#endifvoid __cdecl ButterWorthFilter1(double samplingFreqFs, double lowCutoffFreqFl, double Input[], double Order, double Output[], long len, long len2);long __cdecl LVDLLStatus(char *errStr, int errStrLen, void *module);#ifdef __cplusplus} // extern "C"#endif#pragma pack(pop) here "len2" is acosiated with Output and len with Input. So they are just ordinary arrays. Quote Link to comment
lpassion Posted June 19, 2006 Author Report Share Posted June 19, 2006 thanks, bsvingen I know what you said. In fact i had done the same function prototype : void __cdecl ButterWorthFilter1(double samplingFreqFs, double lowCutoffFreqFl, double Input[], double Order, double Output[], long len, long len2); now i want to do one thing that how to get the Output array from LabVIEW to C or Java program. That is to say, how does LabVIEW return the data type and program for the realization in c or java? i guess, in this function, that get the pointer of Output array from the LabVIEW. But i am not sure. I don't know hot to do this! void ButterWorthFilter(double samplingFreqFs, double lowCutoffFreqFl, double Input[], double Order, TD1Hdl *Output, long len) thanks to all! Quote Link to comment
bsvingen Posted June 19, 2006 Report Share Posted June 19, 2006 Well, right now i am not sure what your problem is. A DLL is a DLL and a C array is a C array no matter how you look at it. I call to that DLL is therefore like any other DLL calls, and those arrays are like any other C arrays. I would try initializing both arrays in your C/Java program before you call the DLL with them. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.