prashant_bhutani Posted May 21, 2010 Report Share Posted May 21, 2010 (edited) HI all, I have been trying to build a DLL. A function (say check) is passing array as an argument and I want to resize it. I am passing the argument as a array handle in LV. BUT the problem is whenever I tried to run VI it crashed on the point of calling SetCINArraySize / NumericaArrayResize. I have searched(google/NI/this forum) a lot but it went in vain. Someone please tell me where it is going wrong. Thanks in advance One more thing is Bugging me, as in following code my function definition _declspec (dllexport) long check(strt *trial) { int i; long len = strlen(trial->arr1); if(trial->size_arr< len) { trial->arr[4]=7897; return trial->arr[4]; } else return trial->size_arr; } here I am passing a structure to the function typedef struct { int *arr; int size_arr; char *arr1; }strt; when I am looking in the modified array in LV's VI , it is showing the same array but returning 7897. DOES it mean array is getting modified??? IF TRUE, why am I not able to see modification in VI?? IF NOT, why the return value is 7897??? Does one can change the value of passed parameters from the VI? Edited May 21, 2010 by prashant_bhutani Quote Link to comment
prashant_bhutani Posted May 21, 2010 Author Report Share Posted May 21, 2010 is there no one who can solve my problem?????????? Quote Link to comment
Antoine Chalons Posted May 21, 2010 Report Share Posted May 21, 2010 is there no one who can solve my problem?????????? well, you posted your question just a little over an hour ago... give people a chance to wake up. Quote Link to comment
Rolf Kalbermatter Posted May 21, 2010 Report Share Posted May 21, 2010 HI all, I have been trying to build a DLL. A function (say check) is passing array as an argument and I want to resize it. I am passing the argument as a array handle in LV. BUT the problem is whenever I tried to run VI it crashed on the point of calling SetCINArraySize / NumericaArrayResize. I have searched(google/NI/this forum) a lot but it went in vain. Someone please tell me where it is going wrong. Thanks in advance One more thing is Bugging me, as in following code my function definition _declspec (dllexport) long check(strt *trial) { int i; long len = strlen(trial->arr1); if(trial->size_arr< len) { trial->arr[4]=7897; return trial->arr[4]; } else return trial->size_arr; } here I am passing a structure to the function typedef struct { int *arr; int size_arr; char *arr1; }strt; when I am looking in the modified array in LV's VI , it is showing the same array but returning 7897. DOES it mean array is getting modified??? IF TRUE, why am I not able to see modification in VI?? IF NOT, why the return value is 7897??? Does one can change the value of passed parameters from the VI? This post is unstructured to the point of complete incomprehensibility. You start with NumericArrayResize/SetCINArraySize and then go to a completely different topic. You do not provide any code that shows your problems with the original problem so all I can offer to this aspect is following: If you haven't found anything sensible about NumericArrayResize in your search you have simply not searched enough and probably not at the right places. Google should be able to find quite a bit about that but the ultimate place to go and search for this information is www.ni.com who incidentially are the makers of LabVIEW and have a lot of online support resources available. NumericArrayResize() is required to resize LabVIEW array handles. SetCINArraySize() does similar but can only work in a CIN as one of its parameters is the parameter index to the CIN so that the function can determine the datatype of the parameter and only a CIN code resource has the necessary infrastructure to provide this information. But as you should have read elsewhere, CINs are old legacy technology and should not be used for new designs, since shared libraries (DLLs) work just as fine and are much easier to maintain and support. As to your second problem, your strt is a completely LabVIEW incompatible C structure. LabVIEW represents arrays (and strings are really just special byte arrays) as a handle and that is something VERY different than a C pointer. So you can not pass an embedded string pointer inside a structure (cluster) from a LabVIEW diagram as you try to do. If you want more detailed information you will have to make some more effort. Show us what you have tried and doesn't work. And don't talk in a single message about one problem and suddenly switch in the same message over to a completely different problem without explaining yourself in detail. Quote Link to comment
prashant_bhutani Posted May 24, 2010 Author Report Share Posted May 24, 2010 (edited) @rolf Firstly SORRY for the incomprehensible post and you will never find such post from my side again. I beg your pardon that I didnt just put my question on getting NumericArrayResize or any other thing. I posted it after struggling (continuous googling) for three days. Though I can agree on this point that I didnt get any useful link (As I didnt find that CIN is old legacy function and it is not used today). Actually I am an internee and I have started using LV since last week only. Thats why getting a little bit of trouble as no one here has ever passed array as a handle so they dont know how to resize the array in shared library(DLL). BTW thanks for the information. I will search ni.com as per your suggestion and will pin you again in case of any trouble Edited May 24, 2010 by prashant_bhutani 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.