LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem: Array data from a COM object works fine at first call, but it crashes at following calls

"If I retrieve array data from a COM object using the
variant_to_data.vi it works fine at the first call, but at following
calls there are no data or LabVIEW hangs or chrashes.
I'm using LV 6.0.2. Is there anybody who has an idea?"
0 Kudos
Message 1 of 6
(2,408 Views)
Not easy to say with this scarce information.
Which COM object is it, do you know what's going on inside?. Who allocates the memory for your array? If done by the COM server, are you sure, it is a "safearray"?

Gabi
7.1 -- 2013
CLA
0 Kudos
Message 2 of 6
(2,408 Views)
Thank you for your answer. Here are some more information.
What I do is to implement several libraries containing a lot of
COM-interfaces (>100) i a LabVIEW application. The libraries are provided
by the manufacturer of the physical instrument. There is a very good documentation
and i stay in contact with the author of the libraries. Until now I have implemented all COM-interfaces I need. The only unsolved problem is that the variant_to_data.vi crashes after 2 .. 6 calls. I use a referenced method called "GetData" which deliveres a variant containing the data in form of a safearray struct. These variant data will be transformed by the variant_to_data.vi (included in LabVIEW). At the first run I get the right data, sometimes it works a second and third t
ime but then it delivers no data (array length 0) or LabVIEW crashed with an error message "abnormal termination" or without any message.

The allocation of memory for the array is done in background. It's different from calling DLL functions. The datatype which is referenced to the variant_to_data.vi is a normal array of real numbers (single). The variant_to_data.vi is able to read the data from a safearray struct and gives an array output of the appropriate size.

Steffen.
0 Kudos
Message 3 of 6
(2,408 Views)
Gabriela Tillmann wrote in message news:<506500000005000000055E0000-1012609683000@exchange.ni.com>...
> Not easy to say with this scarce information.
> Which COM object is it, do you know what's going on inside?. Who
> allocates the memory for your array? If done by the COM server, are
> you sure, it is a "safearray"?
>
> Gabi

Thank you for your answer. Here are some more information.
What I do is to implement several libraries containing a lot of
COM-interfaces (>100) i a LabVIEW application. The libraries are
provided
by the manufacturer of the physical instrument. There is a very good
documentation
and i stay in contact with the author of the libraries. Until now I
have implemented all COM-interfaces I need. The only unsolved problem
is that
the variant_to_data.vi crashes after 2 .. 6 calls. I use a
referenced method called "GetData" which deliveres a variant
containing the data in form of a safearray struct. These variant data
will be transformed by the variant_to_data.vi (included in LabVIEW).
At the first run I get the right data, sometimes it works a second and
third time but then it delivers no data (array length 0) or LabVIEW
crashed with an error message "abnormal termination" or without any
message.

The allocation of memory for the array is done in background. It's
different from calling DLL functions. The datatype which is referenced
to the variant_to_data.vi is a normal array of real numbers (single).
The variant_to_data.vi is able to read the data from a safearray
struct and gives an array output of the appropriate size.

Steffen.
0 Kudos
Message 4 of 6
(2,408 Views)
Naja...
I did it only from the labview side and had my colleagues redo their VC++ side again and again. If you have an array of basic Labview types (see help on COM in LV) it should be no problem. Just make sure the COM server allocates it's memory with the right methods. And Labview will copy the contents and return the memory.
Then no VARIANT is needed at all. If you have compounds (clusters, structures), then it is most probably a problem how Labview handles space for this type of Data. Rather weird, is the best I can say. Check the documentyation on C-program nodes.

Wundert mich dass sonst kein Guru was wei?, Viel Erfolg.
Gabi
7.1 -- 2013
CLA
0 Kudos
Message 5 of 6
(2,408 Views)
I'd like to know if there are any updates on that problem since I'm experiencing exactly the same thing with the Variant_to_data Lv module.

The proprietary COM server works perfectly fine with VB and teststand. Only Labview is causing the problem.
Labview version: 6.0.2

Thanks, Milijan
0 Kudos
Message 6 of 6
(2,408 Views)