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
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
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,
...@elis.ugent.be
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
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
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
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