[fpc-pascal] Re: assign code to a method
montesin at uv.es
Sun Feb 20 08:23:47 CET 2011
El 18/02/2011 17:59, Andrew Haines escribió:
>> From the other comments it seems like you are writing some assembly to
> memory at runtime then calling that code?
That is right.
>If so then maybe the following
> can help you.
> so the usage would be like so
> function TTrampolineManager.GenerateCode(args: ....): Pointer;
> Result := CurrentBlock.Position; // = @Block + Block.Cursor
> WriteData(your_data, size_of_data);
> until done;
> on e: TrampolineBlockFullException do
> Result := GenerateCode(args);
> Hope this helps :)
A lot! I understand that for purposes other than trampolining, the
essence of this is the the way of building an almost contiguous list, say
Block: array[0..lastCodePiece] of Pointer;
of DEP executable codes inside an authorized chunk of memory, and that
the call for assigning one of them, Block[i], to some function declared as
otherObject.thisFunction(other args): Double;
And also the way to obtain another block when one of them has
been exhausted, and the way of disposing of them, right?
Many thanks, Andrew. I intend to apply this to my old programs in 32
bit Windows. I'll tell you about the outcome.
montesin at uv dot es
More information about the fpc-pascal