NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

creating .net object of singleton class in Labview

I Have 1 .net assembly and that assembly have one .net class with Singleton design pattern. Now I want to create .net reference of this Singleton class and use its functions in my lab view program. Currently in lab view, I have to choose Constructor Node to create .net reference, but in my case as this .Net class is singleton, it does not have any constructor as such so not able to create its .net reference. Can you please help me to create .net reference of my .Net Singleton class in my lab view program.
0 Kudos
Message 1 of 5
(4,231 Views)

Hello,

Did you find a solution?

 

I have almost same situation.

 

A VI will call a methd from a .net dll. In the dll I have a static property. At the first call I have a "new" and I alocate memory to a static variable.

After some time I will call another method from same dll and same class. The static variable that was alocated before it's seems that is not alocated anymore.

 

If I try to make a singleton from my class I cannot, becouse I need a constructor in order to call function from Labview(as explained in the preview message posted).

 

The interesting is next. If I do the two calls from same vi everyting is ok, but if I do this calling from the Teststand using the labview adapter is not working anymore.

 

What should be the solution?

 

Thank You

0 Kudos
Message 2 of 5
(3,959 Views)

Perhaps the approach provided in this help topic might help in the singleton case: Using Static .NET Properties and Methods

 

Thanatos, with regard to your comment: "if I do this calling from TestStand using the LabVIEW adapter is not working anymore", are you calling the same two VIs from TestStand? If so, what version of TestStand are you using? Are the VIs located within LabVIEW Projects? If so, and you are using TestStand 2010, have you configured the LabVIEW steps to point to the LabVIEW Project?

Manooch H.
National Instruments
0 Kudos
Message 3 of 5
(3,933 Views)

Hello,

 

Unfortunatly we still use the TestStand 3.1 and LabView 7.1.

I have installed LabView 8.0 and it seems that this issue was solved.(with 7.1.1 still same problem)

 

I converted all the VI's to LabView 9  with mass compile and I made a source distribution even a Deployement From TestStand.

 

It seems that only with Deployement it worked. But I had to copy mannually my custom dll-s into some folders where the VI's were. It not clear to me exactly what were the rules.( the dll-s must be in the same folder with the top vi I think)

 

For now we cannot migrate to a greather versin of TestStand.

0 Kudos
Message 4 of 5
(3,902 Views)

You can always write a wrapper class in .NET that does the access to the statics for you and exposes them as instance methods on your wrapper class.

 

-Doug

0 Kudos
Message 5 of 5
(3,891 Views)