Skip to content

VAR_INST and FB_Init #241

Discussion options

You must be logged in to vote

So in summary, unless someone pops up with a secret angle, you cannot instantiate variables in VAR_INST using local variables in the same header. This works everywhere else, but not in a method's VAR_INST.

Work arounds that I know of (that largely don't meet my needs wants in 4024):

  1. Put the object you want to pass to the others in the main function block, as Jakob suggests, or a gvl or something
    • This violates keeping the scope as small as possible, so not great for production code but fine for unit tests if you're careful
  2. Put all the objects in a struct, then put the Struct in VAR_INST
    • This doesn't work nicely if one of the things is an array, since you'll need a different struct for…

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ColonelPanic-Dev
Comment options

You must be logged in to vote
1 reply
@ColonelPanic-Dev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants