Jump to content

prashant_bhutani

Members
  • Posts

    10
  • Joined

  • Last visited

LabVIEW Information

  • Version
    LabVIEW 8.6
  • Since
    2009

prashant_bhutani's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. @rolf I am able to understand the LabVIEW syntax for handles quite a bit now. I will try the code. A lot of thanks for helping me out.
  2. Thanks rolf for so much of valuable information. BTW, I am not rewriting first element to zero as I am starting loop from i=1. I am attaching the zip file containing all my code and VI. I hope it will give you more insight in my problem. structure_passing.zip
  3. Hi all, I am doing a summer project in which I have to pass clusters to LabVIEW. Since I have to pass am image so one data type is common to each cluster ,i.e., a dynamic array (signifying image) which needs to be resized according to the size of image. I am a novice to labVIEW (just started one week ago). So What do you people suggest whether I should go with DLL or CIN to pass the cluster to VI?? Reason for pointing this question: http://zone.ni.com/r...s_vs_clf_nodes/ says "You can pass arbitrarily complex data structures to and from a CIN. In some cases, you might have higher performance using CINs because data structures pass to the CIN in the same format that they are stored in LabVIEW." while other documents/forums says that "It is quite difficult to pass a structure containing an array/string to LabVIEW (which is the case with DLL)". Please do tell me because my mentors have never used CIN. Also, they never passed any cluster containing array/string as its member using call library nodes. Thanks in advance
  4. Hi, I have changed the code a bit and the new one is _declspec (dllexport) int trial(int **arr) { MgErr err = NumericArrayResize(iL,1,(UHandle*)&arr,10); if(err == noErr) { for(int i=1;i<20;i++) (*arr)= i; return 2; } return 4; } Now if I pass an initialized array of elements less than 20....... then EXPECTED (after reading so much documentations and forums) output should be crashing of LV due to corruption of its memory in shared library(DLL) BUT strangely the output array is showing me elements upto the initialized elements and still no sign of breakdown CAN anyone explain me the reason for this? or have I read a lot that it corrupted my memory??
  5. Lets see it this way..... arr is a pointer to a pointer (**arr).... so I need to cast it to UHandle** but then it will not be appropriate as handle is to/for point/handle pointers.... Now see what (UHandle*)&arr is (or better say try to) doing... &arr is pointing to 0th element of array and (UHandle*) is casting that pointer to appropriate type so that it can be identified by LV.. please correct me if I am thinking in a wrong way @rolfk please tell me where is it getting wrong??? The situation is like as I said in one of my previous post:: 1) NO output on passing NULL array (but the return value is 2) 2) Passing initialized array but result is up to those elements of initialized array only. I am attaching the snapshot of VI that I am using.
  6. HI there! Lets assume this line of code is causing the application to crash.... THEN why this application runs well after de-commenting the comment....... This was not meant to insult anyone as I believe that my code could be wrong BUT I cannot believe someone until he gives me a reason which is applicable to whole program not for just one case. Hi, I am passing a null array as a parameter from LV but when I am looking at the indicator, it is not showing any result even for values/elements less than 10..... If i pass an array with some elements, the indicator is showing values upto those corresponding elements only...... one last thing is using (*arr)[0]=10 is a good idea???
  7. #include "extcode.h" BOOL WINAPI DllMain(HANDLE handle, DWORD dwFunction, LPVOID lpNot) { return TRUE; } _declspec (dllexport) int trial(int **arr) { MgErr err = NumericArrayResize(iL,1,(UHandle*)&arr,10); if(err == noErr) { //(*arr)[0] = 10; for(int i=1;i<10;i++) (*arr)= i+1; return 2; } return 4; } This is the code I am trying with, but the application is crashing again n again and my VI application is showing the array size ZERO. But since the return type which I am getting is 2, means the function is getting executed. During my search I came to know that the array in LV is like "First 32 Bytes for array length and other for data means n+4 bytes for n unsigned-8 bit data". So when I am de-commenting the comment, my VI program is executing well and my VI is showing the array size 10. (Is it the write way to allocate memory???? or is it a BUG??) NOW the main question where is the problem??? 1) IS NumericArraySize not allocating the required memory (if this is the case then why MgErr == noErr ??) 2) Is there something else which I am missing????
  8. @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
  9. is there no one who can solve my problem??????????
  10. 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?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.