[fpc-pascal] Re: Using FPC as a scripting engine
Michael Van Canneyt
michael at freepascal.org
Mon Oct 16 12:33:21 CEST 2006
On Mon, 16 Oct 2006, Alexander Todorov wrote:
> On Fri, 13 Oct 2006 12:45:55 +0200 (CEST)
> Michael Van Canneyt wrote:
> > > There was no response to my first e-mail so here are some examples of
> > > what I want to do:
> > >
> > > http://www.codeproject.com/csharp/runtimecompiling.asp
> > > http://developer.apple.com/documentation/mac/IAC/IAC-334.html
> >
> > I find this all horribly complicated.
> >
> > Why don't you simply keep the compiler external, compile everything
> > in a library, load the library and execute a well-known function,
> > passing it an 'environment' interface ?
> >
> > Michael.
>
> Yes that could be a solution. It seems easy to implement and work
> with. But I want to try emulate what Pascal Script is doing. Also I am
> wondering is it possible to execute code that is compiled/placed in
> memory (e.g. do all stuff that is normaly done by the OS to load the
> application and then execute it (don't know exactly how)).
It's tricky; newer OS-es and CPU's have some flag to protect data memory
so it cannot be used to execute code (it broke many programs).
So your idea simply might not work on these systems.
Pascal script really is a bytecode interpreter, not a compiler.
Only when it calls native code, it has to do some stack setup,
but that is a minor part and in no way interferes with the flag
I mentioned above.
Michael.
More information about the fpc-pascal
mailing list