LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing an object through a shared variable

Solved!
Go to solution

Hello all,

 

I am not sure if the the title is quite appropriate, but it accurately describes what I am trying to do.  I have an application running on an RT machine from which I am attempting to pass an object from the app on the RT machine to a host.  The problem is that when I transform the object to a variant and then stuff the object into the shared variable (the size of the object is about 450 b), I get no response on the host side indicating that the variable has updated.  Probing the error out on the shared variable where I am writing (on the RT machine), it turns out that I am getting error code -2147467259, an unspecified error.  Has anyone seen this error before?  Does anyone have any thoughts as to why this might be happening?  All other variables are responding ok.

 

Thanks, Matt

 

21155i1398DB89C5E463CA

0 Kudos
Message 1 of 9
(4,413 Views)

Matt:

 

Is this the only variable you are using to pass the variant datatype through? Do you know what is contained within the object you're trying to pass?

 

Unfortunately, that error IS pretty generic, so any extra info on what we're converting to a variant might be helpful.

Caleb Harris

National Instruments | Mechanical Engineer | http://www.ni.com/support
0 Kudos
Message 2 of 9
(4,384 Views)

Caleb,

 

Unfortunately there is not a lot else going on that might provide any clues, but I think this may lie in the structure of the class itself (as you imply with your question).  Nested with in the object are arrays of objects, some clusters of numerics and some large arrays of 16 bit integers (I can be more specific if necessary, but I don't have the app in front of me right now).  The data itself is not large currently - about 450 bytes - but will be larger when all of the fields are properly filled out.

 

What is the purpose of the generic error if it can't be used by even the NI folk to determine what went wrong? Is it a place holder for future problems that crop up.  I will try some other things to push the data through and let you know what happens.

 

Thanks, Matt

0 Kudos
Message 3 of 9
(4,360 Views)

Matt,

 

I have not seen this error before, but you may want to check to following:

 

  • Are you able to write other simpler data types (boolean, double, etc) to shared variables without seeing this error?
  • What happens when you convert this object to variant, then back to an object.  Do you see any errors on the Variant to Data function?
  • Have you tried flattening the object to a string instead of using variants?  I would be interested to see if the same error happens with strings.

 

 

On a somewhat related note, you may want to vote for this idea on the Idea Exchange.

 

Chris M

0 Kudos
Message 4 of 9
(4,351 Views)

Done!  I am going to try those things that you suggest to see if I get different results.  Stay tuned!

0 Kudos
Message 5 of 9
(4,346 Views)
Solution
Accepted by topic author cirrusio

OK, so solution found.  For whatever reason, I can not pass the object as a variant.  However, as when I use the STM library, I can flatten the object to string and then pass the data through the shared variable using a string SV.  This is not an unreasonable solution, it just seems that I am doing something very similar as when I pass the data via a variant SV.  Do you have any thoughts as to why I can't pass this using a variant?  Looking forward, is there going to be any support for passing objects directly via SVs?

 

Cheers, Matt

0 Kudos
Message 6 of 9
(4,228 Views)
Message 7 of 9
(4,159 Views)

Brilliant!  I will take a look at it.  Thanks, sachsm

0 Kudos
Message 8 of 9
(4,155 Views)
0 Kudos
Message 9 of 9
(3,030 Views)