error c0265

pach30
2021-07-15
2021-07-20
  • pach30 - 2021-07-15

    Hello

    this error is between engineering talk and runtime tall as IDE give the error on what appears to be an runtime problem.

    Playing with dynamic allocation on Codesys Win64 PLC , I get this error C0265 (not enough memory). My PC has 16 Go Ram , so enough I think . Is it a way to increase the memory allocated to Win 64 PLC ?

    thank in advance

     
  • i-campbell

    i-campbell - 2021-07-15

    do you mean with the __new operator?
    The size is defined by right clicking the application and selecting properties, then going to the Application Build Options tab.

     
    👍
    1
  • pach30 - 2021-07-16

    Thanks you i-campbell !!
    the way you give me was the right way and I can compile using dynamic allocation( with __new operator )

    But , it seem's it's no possible to create un array of personal object by this way ?

    if i declare :

    TYPE MyObject :
    

    STRUCT
    id :DINT ;
    i_Number :INT ;
    sz_genotype :STRING ;
    sz_Plug :STRING ;
    sz_scenario_WS :STRING ;
    sz_scenario_SS :STRING ;
    f_weight_vide :REAL ;
    f_weight_Ref :REAL ;
    f_weight_before :REAL ;
    f_weight_after :REAL ;
    END_STRUCT
    END_TYPE

    I can't write

    pMyObject : pointer of MyObject

    ....

    pMyobject := __new( Myobject,avalue) ;

    what a shame !!

     
  • pach30 - 2021-07-16

    Thank's i-campbell

    But i got error C0249 even with compilation directive 😨

                ------ Processus de compilation entamé : application : CODESYS_Control_Win_V3_x64.Application -------
                Affecter un type à un code...
    

    [ERREUR] Test_divers: FB_Init CODESYS_Control_Win_V3_x64: Logique API: Application: Robot: C0249: La création d’un tableau avec __NEW n’est pas autorisée pour les types définis par l'utilisateur
    La compilation est terminée -- 1 erreurs, 3 avertissements : aucun téléchargement possible

     
  • i-campbell

    i-campbell - 2021-07-16

    interesting. does it work if you use a function block instead of a dut?

     
  • pach30 - 2021-07-20

    Hello I campbell,

    I didn't make this test .
    what I want to do :
    Create an object (in real life a machine ) with a number variable (from 400 to 750) of element .Each element has his own carateristics (so my DUT).

    So , i will use  Fb_init() to make dynamic allocation of x elements (as usual in POO ).
    
    I think it's possible , isn't it ?
    
     

Log in to post a comment.