Array of Structs


#1

Probably a silly question:

I want to define an array of structs in the Local Data of my object, but initialise it with values in the Init Code section. I can't seem to get this to work, for some reason.

Is this possible, and if so, how do I do it?

Or, should I declare the array in Local Data, then assign values on the first K-rate cycle?

a|x


#2

Thinking about it, I need access to Attributes at the time I populate the arrays, so I guess best to have a function that runs once, on the first K-rate cycle.

Answered my own question. Move along, nothing to see here... :wink:

a|x


#3

Attributes are available in localdata and during initialization. I'd suggest to declare and initialize your array of structs in localdata if possible.
http://en.cppreference.com/w/cpp/language/aggregate_initialization


#4

Good to know, thank you, @johannes.

a|x