Without “seal”, the record type can be derived??
No, I believe records are always sealed, so adding the keyword has no effect (but is allowed, because why not?)
1 Like
UserVehicleMethodTable = public record
public
Departure: DepartureEvent;
Parked: ParkedEvent;
Stalled: StalledEvent;
Arrival: ArrivalEvent;
Update: UpdateEvent;
CarFollowing: CarFollowingEvent;
TranitStop: TransitStopEvent;
Position: PositionEvent;
Fail: FailEvent;
end;
PUserVehicleMethodTable = ^UserVehicleMethodTable;
In above type of code, do I have to take care of the memory management of the record pointer, or Island GC will handle it for me?
How can I dynamically create an Island record, like Delphi’s new()?
Above record will not be GC handled no. If you want to manually allocate (And thus release) it, you can use something like:
class method &NewRecord<T>(): ^T;
begin
result := ^T(malloc(T));
memset(^Byte(result), 0, sizeOf(T));
end;
class method FreeRecord<T>(aVal: ^T);
begin
free(^Void(aVal));
end;
1 Like
Got it. I see - Island/Win32 on the native side is very close to C. Closer than Delphi, probably.
Thank you for the heads up.