First of all, thank you for answering.
Then, the problem here is much more complex than what you are suggesting:
I do need to create a function block (A) that configures itself at runtime.
In order to do that I've created a Class Factory (which is another function block (CF) that using interfaces, pointers and the newly added in V3 DMA (dynamic memory assignment) creates the inner function blocks for A.
This avoids the need to create each possible combination and it eases and reduces the code maintenance.
In order to do that easily and avoiding having to code anything in the code area, I'm using the FB_Init (what a constructor would be for a class in normal OOP) function for both CF and A in order to be able to configure them.
All this said, what you suggest is the initialization for a specific user defined type (a structure, ...) even this works, I don't need that.
I do need to be able to initialize the specific FB_Init inside an array of CF at the declaration stage. And this is what I've not found how to achieve. Not documented in the Codesys, TwinCAT neither SoMM documentations, neither in the Google results I've found.
what I'm using outside the aforementioned array is:
fbCF : fbClassFactory(1, 27, 3);
fbA : fbA(ADR(fbCF));
As you can see here I'm passing parameters to the fb_Init function at declaration stage and I would like to be able to do the same in arrays.
That's what I'm asking exactly here.
- robots, CNC and PLC programming.