Re: Object is not Valid Error



keithely wrote:Hi,
I am facing a problem in GetdatatoModify.vi.I am calling
GetdatatoModify.vi in one of my application called write.vi.Once this
is called from my frontend application ,it is showing error that
"ERROR1 object say xxxxx is not valid".This object actually I am
getting from referance from create.vi.I verified referance getting from
create.vi and referance passed to GetdatatoModify.vi are same.
The interesting thing is if I have opened my write.vi in
background,everything will work properly.Then no object invalid problem
comes.I
have no idea what VI you are refering to with GetdatatoModify.vi but I
have a good guess what is your problem. LabVIEW deallocates objects
automatically when the top level VI in whose hierarchy the object was
created goes idle (ceases to run). What you are probably doing is
opening the object reference in one VI writing it to a global and then
doing a Read or write on that object reference from another VI. This
will not work. You have to keep the VI that created the object alive
somehow for the entire duration of your application.
Yet even better is to use dataflow dependancy (thus wiring the refnums
from the create function to the actual read or write function and
structure your program such that this can be done nicely) and forget
about globals for this purpose altogether. Globals are the poor mans
solution for those that can not be bothered to sit down and think about
a design before starting to actually code according to that design
sketched out beforehand.

Rolf KalbermatterMessage Edited by rolfk on 04-12-2006 04:18 PM
.



Relevant Pages

  • Re: defvar affecting captured closure variables ?
    ... but global specials used to be the DEFAULT ... those of us on the CLTL design team basically said something very close ... the *foo* naming convention was not widely used in most ... bind these globals, since otherwise you'll get a lexical foo when you ...
    (comp.lang.lisp)
  • Re: Object reference not set to an instance of an oject
    ... regionList, string selectedValue) ... > "Engine" is the first possible object reference. ... but a perfectly legal part of an object reference. ... > "Globals" would be the second possible object reference. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: WSAStartup, WSADATA, and class hierarchy
    ... >>> class Winsock ... > Then call it from ctor of each of your globals. ... configured for public availability via .conf files, ... It's possible my design is flawed, I'll admit, but I think that ...
    (microsoft.public.vc.language)
  • Re: Singleton Pattern
    ... that uses the singleton pattern to create just about everything. ... When you skip globals and start to pass variables ... you alter your design so that you don't have to do that as ... you discover that not everything needs the database and your design ...
    (comp.object)
  • Re: DTS SQL 2000 Global Variable initialization problem - please h
    ... What I was trying to say is that globals to persist. ... Many people put "settings" in them at design time that control execution. ... will be cleared, others will be set from config files, database lookups, etc. ...
    (microsoft.public.sqlserver.dts)

Loading