Hello,
I am trying to call a function in a DLL whose signature is as below
datablock* foo(datablock db);
where datablock is :
typedef struct
{
unsigned char data[10240];
unsigned int no_of_bytes;
unsigned long start;
} datablock;
this is actaually a wrapper for a function which return the datablock by value.
Labview Import manager chokes and i have to kill labview, when i try to import this function. so i tried to call this function with call library function node and i am unable to get it to work.
In the call library function i tried to pass the struct by using
1)adapt to datatype,
2) spliting the struct and passing the elements individually.
The call library function returns a pointer which i tried to give it to MoveBlock and tried to move the data but i get Access violation(which leads me to think i'm trespassing labview's memory).
i tried using GetVallueByPointer.xnode. This time it did not crash but it does not give proper results. from what i observer only the no_of_bytes seems to be correctly received.
basically what i saw is that i can neither pass nor receive these structs by pointer ref and dereference them successfully..
One more thing is that if i try to write the struct argument in the function labview immediately crashes always.
i have attached the code (demo.cpp,demo.h), dll(demo.dll), VI that reads this dll.
I used gcc 4.8.1 to generate the dll and LabVIEW 2013.
i have searched
(http://lavag.org/forum/25-calling-external-code/?prune_day=100&sort_by=Z-A&sort_key=last_post&topicfilter=all),
(http://lavag.org/topic/17100-problems-with-calling-a-dll/)
(https://decibel.ni.com/content/docs/DOC-9079)
i also searched labview help but am still failing to get this to work
Thanks for the help in advance.
Labview_cpp_dll.zip