LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recursion Error with Dynamic Dispatch + Shared Clone

I'm using LV 2013, fp2. I have a small class with a Dynamic Dispatch SubVI, Parse.vi, which is configured for Shared Clone reentrancy. When I try to run this recursively, LV throws an error: "Attempted recursive call." (yes, I know LabVIEW, that's the goal! Smiley Happy )

Load child from file, call child's parse.

The purpose of Parse.vi is to instantiate a Child class based on partial string input, then run Child.Parse.vi with the remaining string input. The Child may override Parse.vi to pre-process the input, but it will eventually call Parent.Parse.vi.

 

The internet says Dynamic Dispatch + Shared Reentrancy is possible, so why am I getting this error?

https://forums.ni.com/t5/LabVIEW/dynamic-dispatch-and-reentrant/m-p/893612#M403399

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/creating_recursive_mem_vis/

 

Thanks for any help!

0 Kudos
Message 1 of 4
(2,795 Views)

It might be beneficial to post a small reproducing case of this if you are able and the issue is still occurring so that the community can take a look given that the answer to this may reside in settings that are not obvious from the block diagram.

 

Just to confirm, you've checked that the VI is not set to pre-allocate for each clone and you have set it to share clones correct?

 

Thanks,

Alex

Alex W.
0 Kudos
Message 2 of 4
(2,697 Views)

Hi all, I have stumbled over the same issue and wonder, why recursion is not allowed for dynamic dispatch VIs. This seems like a strong limitation. I've created a simple example attached that demonstrates the issue. It consists of  a Parent- and Child-Class, where the Child contains an Array of "other parents" objects. There is a dyndispatch Update.vi in both classes. The child calls the update function for each parent it contains.
As soon as I try to call the Update method of one of the "other parents" that is a child itself (and will call it's "other parents" update methods => recursion), it throws the error.

To also link this to my actual problem, It's a bit of a training project for me:
I'm trying to create a Layout Manager that controls the position of controls on the front panel. E.g. align them vertically with a fixed distance. All should happen dynamically as far as possible. I therefore have a "Widget" class that stores Position and Size of an Object. The Widget is abstract and implementations are:
Ctl-Widget - stores a LabVIEW Frontpanel Control and controls it's size and position
Layout-Widget - Contains an array of other widgets it aligns vertically or horizontally with spacing and padding

This way I can have nested Layouts, so a vertical arrangement of controls that contains a horizontal arrangement of buttons as a widget. This recursion would usually go a few layers deep maximum.
I wonder how to properly implement this and I'm open for suggestions.

0 Kudos
Message 3 of 4
(217 Views)

Just solved my problem with this:
https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/errors/recursive-reference-with-no-shared-...

The DynDispatch VI must be shared-clone. So the question in this thread is still unexpected to me, but my example works with reentrancy.

0 Kudos
Message 4 of 4
(199 Views)