Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 9 Jahren, 2 Monaten
Letzter Beitrag:
vor 9 Jahren, 2 Monaten
Beteiligte Autoren:
BLS, Victor Hernandez.pcs.crosspost

Freeing Structures

Startbeitrag von Victor Hernandez.pcs.crosspost am 06.05.2009 06:37

Ive declared structures within Project Code, and im using them in classes
declaring them Globally for the class.
When i use a class i use the following syntax

lcl_class is object dynamic = new class_test
lcl_class = new class_test

and im having trouble with the structure that im using inside the class, it seems the values from the structure dont reset after the event in which the class is declared exits, i tried using:
delete lcl_class
To free the memory from the objects so the values from the structure reset but it didnt work, and i tried to delete the structure before the event exits but it throws a warning: Unable to free non-dynamic object.
What am i doing wrong

Message forwarded from pcsoft.us.windev


HI Victor,
your code looks a bit wrong :

lcl_class is object dynamic = new class_test
lcl_class = new class_test

the first line is already enough.

Next, you talk about structures ,,, in case that you want to delete (free) a structure you have to declare them as follows :
// Global structure
st is structure
v is int

within your class you can write something like this :
myStruct is st dynamic
// Constructor
myStruc = New st
// Destructor
Free myStruct

HTH, Björn

von BLS - am 06.05.2009 12:19
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.