External lib with Globals (non native)

This test case it part of the test suite proposed for new devices.

Test case ID: R0901
Language: ST

Code:
tests2/t0901.st
(* requires function LIBFUNC2 defined inside func1.zip and global vars VG1 VG5 *)

PROGRAM X01LIB
VAR
    C2,C3,C4,C7,C0: INT;
    fb1,fb2: LIBFB2;
    M1 AT %MW63.5 : INT ;  // same as VG1!
    T : INT; // Loop count
END_VAR
VAR_EXTERNAL 
        VG1, VG5 : INT;
    _T_PARAMS : TEST_PARAMS;
END_VAR 

  T := T +1;
  IF T = 1 THEN (* initialization *)
    VG1 := 100;
  END_IF;
  
                 //         1st                        2nd
                 //        VG1=100 VG5=5
   fb2(i:=10);   // o=121  VG1=110 VG5=55       | o=569  VG1=228 VG5=220
   fb1(i:=1);    // o=222  VG1=120 VG5=105      | o=670  VG1=238 VG5=270
   fb1(i:=20);   // o=351  VG1=130 VG5=155      | o=799  VG1=248 VG5=320

   C2 := fb1.o;   // 351                        |               799
   C3 := fb2.o;   // 121                        |               569
   VG1 := VG1 + 8; //  138                      |              256  
   VG5 := VG5 + 15; // 170                      |              335
   M1  := M1 +  80; // 218 (= VG1)              |              336 
  //_GEB_MSG_(INT_TO_STRING(M1));
   C4 := M1;    
   C7  := VG5;

IF _T_PARAMS.cycle = _T_PARAMS.timestorun THEN  // last iteration
     _GEB_ASSERT_(C2 = 799);
     _GEB_ASSERT_(C3 = 569);
     _GEB_ASSERT_(VG1 = 336);
     _GEB_ASSERT_(VG5 = 335);
     _GEB_ASSERT_(C4 = 336);
     _GEB_ASSERT_(C7 = 335);

//     _GEB_MSG_(INT_TO_STRING(C7));
END_IF;

END_PROGRAM