Originally Posted by
ReneMiner
I tested a little... and came to the result it does not work as expected so I did not finish this to more functionality yet - has a couple of useless functions now, but shows what I was up to. Because no retrieving of type possible I just pass it as parameter on Create
The types get recognized and used correctly - but just once per script execution. Calling twice the same sub with a different type to use will always dim the type again that was dim'ed the very first time... The example is a little longer, for try out/ see what I mean just exchange the order of the Test-call at end of script
If you debug you will se that the problem is at:
Function t_virtual_object.Create(ByVal sType As String, Optional ByVal lNum As Long) As DWord Local Data Like "" & sType '<<<<<<<<<<<<<<<<<<<<<<<<<<
and at:
Sub Test(what As t_virtual_object) If HEAP_Size(what.pData) < 1 Then PrintL "Error- no data!": Exit Sub
Local data(HEAP_Size(what.pData)/what.lSize) Like "" & what.sType At what.pData '<<<<<<<<<<<<<<<<<<
Like operator interpret the data type not like a data type but like a variable of a certain type.
Add a
and it will get the string as string expression and create the real data type overlay.
I will fix asap, not today, sorry.
In any case there is a much bigger problem. ThinBASIC always try to optimize code execution. When it executes the following line the first time:
PrintL data(1).GetProperties
it stores inside internal optimization structures what is Data so the second time all the info are already there.
But here we now have the possibility that Data is many different things in all different executions.
I need to understand what to do in order not to store any info about Data without slowing down execution.
Eros
Bookmarks