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