Hello, I was looking for this :-). Unfortunately, your yannickasselin1 method didn't work for me. I came up with a workaround - instead of FB_INIT I created a normal method: INIT (with the same implementation as FB_INIT). But since it's not called before running, I call them separately inside the FB_INIT method in another FB. For Example: MyObject METHOD init VAR_IN_OUT ptrCF : ptrCF; END_VAR HelpObject METHOD FB_INIT FOR i := 0 TO 3 DO MyObjectArray[i].init(ptrCF[i]); END_FOR GLOBAL_VAR MyObjectArray:...
Hello, I was interested. Unfortunately, your yannickasselin1 method didn't work for me. I came up with a workaround - instead of FB_INIT I created a normal method: INIT (with the same implementation as FB_INIT). But since it's not called before running, I call them separately inside the FB_INIT method in another FB. For Example: MyObject METHOD init VAR_IN_OUT ptrCF : ptrCF; END_VAR HelpObject METHOD FB_INIT FOR i := 0 TO 3 DO MyObjectArray[i].init(ptrCF[i]); END_FOR GLOBAL_VAR MyObjectArray: ARRAY[0..3]...
There is a way around to to that - instead of returning generic variable, writing result value to the given pointer: FUNCTION EXT_LIMIT VAR_INPUT anyValue : ANY_BIT; result : POINTER TO BYTE; END_VAR VAR lwValue : LWORD; END_VAR SysMemCpy(ADR(lwValue), anyValue.pValue, TO_DWORD(anyValue.diSize)); lwValue := LIMIT(0, lwValue, 10); SysMemCpy(result, ADR(lwValue), TO_DWORD(anyValue.diSize)); The function call is not beautiful, but it works ;-) EXT_LIMIT(BYTEValue, ADR(BYTEResult)); EXT_LIMIT(WORDValue,...