Re: Dynamic calling
- Posted by DerekParnell (admin) Sep 19, 2009
- 1208 views
Re:
http://openeuphoria.org/docs/eu400_0095.html
It's not clear to me what can be put into allocated memory marked as executeable.
Anything can be put into executable RAM, however it is normally only used for holding machine code.
If i have a running application that allocated the memory, tagged it as executeable, do i load a Eu source code file into it? Or a pre-interpreted IL file (and how do i get that IL?)?
Neither. Both source code and IL are data and not machine code. You do not need to use executable RAM for either of these things.
Or does it need to be a dll?
Or does what need to be a DLL? I'm not sure what you are referring to by "it" here.
If i can load some Eu source code into it and then routine_id to it, isn't that string execution?
No, it is not string execution. String execution is where you get your application to invoke the Euphoria interpreter to 'execute' a string containing Euphoria source code. Loading source code into a RAM location and calling routine_id() won't work. The routine_id() function needs a string containing the name of a parsed function to call as an argument and all you would have is a RAM address and a string containing source code - and neither of those is the name of a routine that has already been parsed.
In order to use executable RAM in this manner, you would have to somehow convert the Euphoria source code to real machine code, and load that machine code into executable RAM and then invoke it using the c_func() routine.
If i do this, say, 2000 times, is memory going to be so fragmented that winxp is nuked?
Loading 2000 times or allocating 2000 times? But in any case, that wouldn't trouble XP at all.