Jump to content

alireza m

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by alireza m

  1. thank you so much. and something else is bothering me. I have to make a dll out of the .c file I get by "create .c file"?
  2. thanks, but I used your code and in shared library wizard I got this error : _declspec(dllexport) MgErr GetArray(Int2DArrHdl* arr, size_t dim_x, size_t dim_y); Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add preprocessor definitions. Click the Back button to return to the previous page of the wizard to add a preprocessor definitionsl (for example, "NIAPI_stdcall = __stdcall" or "NIAPIDefined = 1"). The following header file was not found in the specified header file or one of the referenced header files: - extcode.h - lv_prolog.h - lv_epilog.h To fix, click the Back button to go to the previous page and add the header file path to the Include Paths list. after all this I think the problem is mostly using shared library wizard and the best choice is using call library function node can I allocate an array in c and after initializing it copy its data to an array like here to pass the array data? by the way my data is large like 3000*3000 and I might get access violation error running my dll vi. #include "extcode.h" _declspec(dllexport) void ARRAY2D(double *array, int array_length_row, int array_length_col); _declspec(dllexport) void ARRAY2D(double *array, int array_length_row, int array_length_col) { int i, j; for(i = 0; i < array_length_row; i++) { for(j = 0; j < array_length_col; j++) { array[(i * array_length_col) + j] = array[(i * array_length_col) + j] * array[(i * array_length_col) + j]; } } }
  3. thanks for your opinion but I want to find a way to pass the actual array not some pointer to it
  4. I am trying to pass a 2d array initialized with large data in my c dll to labview, but no matter what I only get a pointer to the array at best shot. I want to get the array as return type from the function I get when I use labview shared library wizard. #include<stdlib.h> #include<stdio.h> #include<stdint.h> __declspec(dllexport) int* get_results(){ int *array; array=malloc(3*3*sizeof(int8_t)); int a=0; for (int y=0;y<3;y++){ for(int x=0;x<3;x++){ int index=y*3+x; array[index]=a; a++; } } return array; } for this I get "get results.vi" which after running it I only get a negative number. and for this one : __declspec(dllexport) int get_results(){ int *array; array=malloc(3*3*sizeof(int8_t)); int a=0; for (int y=0;y<3;y++){ for(int x=0;x<3;x++){ int index=y*3+x; array[index]=a; a++; } } return *array; } I got get results1.vi which I get nothing after running the vi. I don't know how should I make the function or dll that I get the array from the vi that shared library wizard gives me please help me get results1.vi get results.vi
×
×
  • Create New...

Important Information

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