Hi everybody,
I have the following situation:
1. there is a packed record type variable populated by some entity
type
TMyRecord = packed record
f1: Int
f2: Int
f3: Int
f4: Single
f5: Single
f6: Single
f7: Single
end
var
x: TMyRecord
2. This variable is passed to a procedure by means of two parameters: StartPointer: Pointer, MemoryLength: Int64
procedure MakeSomething(StartPointer: Pointer, MemoryLength: Int64);
[...]
MakeSomething(Addr(x), SizeOf(TMyRecord));
In this way I get into the procedure with the memory area where the variable x lives.
I would like to use a TStream, because inside the procedure there is an activity that writes to db, that would like to get a TStream as input, something like this:
ParamByName('samplingData').LoadFromStream(stream, ftBlob); // <--- it would be nice if stream contains the memory area used by variable x
I need to have a sort of TStream able to read from the memory area from StartPointer to StartPointer + MemoryLength - 1 so that no extra memory is allocated because the memory area used by x will exist during the call to the procedure, and the procedure is called billion of billion times per hour.
Is there anything ready or do I need to implement a custom stream??
Thank you very much!