The correct statement is therefore:
Move(functionCode[1], FBlock^.code^, len);
It would also be cleaner to use a dynamic array instead of a string
to store arbitrary binary data (in that case, you'd have to use
functionCode[0] above though).
I have tried yours and other combinations. The fol
quot;FPC-Pascal users discussions"
Sent: Wednesday, February 23, 2011 7:54 AM
Subject: Re: [fpc-pascal] Re: assign code to a method
On 22 Feb 2011, at 21:24, Angel Montesinos wrote:
one uncomments the commented line of code, that is makes
codeFunction:= '',
the program fails
On 22 Feb 2011, at 21:24, Angel Montesinos wrote:
> one uncomments the commented line of code, that is makes
> codeFunction:= '',
> the program fails.
>
>
> What may be happening here?
This code is wrong:
functionCode : AnsiString; {the function opCode sequence}
...
Move(functionCode
Forgot to tell that the program was written, compiled and tested with
Delphi6 PE for Windows 32 bits
Sorry.
--
montesin at uv dot es
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Many thanks, Andrew. I intend to apply this to my old programs in 32
bit Windows. I'll tell you about the outcome.
Below you will see a console application for testing your suggestions
or better my understanding of them. The results are (in Windows XP 64
bits Pro):
1. When Data Executio
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.
...code...
so the usage would be like so
function TTrampolineMan
El 18/02/2011 13:46, Sven Barth escribió:
I personally would say that mapping a page with the Execute flag set
and storing the to-be-executed content there should be enough. After
all JIT compilers must do that as well. ;)
Thanks. I shall study this issue.
--
montesin at uv dot es