I have a environment and I want to know that if I write code in this environment is it possible to save>compile and use that code?
whats is more is that I want the environment to be able to call function in this code and for the code to be able to call function in the environment..
I think there was something called class loaders in java that allows you to do this.. can I do this is Delphi and what is the best way to go about doing this?
(just in case anyone says about putting it in there to start with its for a game for kids, they will just write a section of the code dealing with simple logic and variables and have calls to methods that 开发者_C百科are in the environment that move a virtual robot)
Delphi doesn't have any facilities for compiling code at runtime, but there are a fair number of scripting languages that do. Take a look at PascalScript from RemObjects, for example. It can do most of what you're looking for, though it doesn't have any facility for creating new classes. I don't think any script engine does. But it can import existing ones from Delphi and create new Pascal functions and procedures for your program to interact with.
You should be able to do what you need to do using paxCompiler.
If you absolutely need compiled code, you can use freepascal to generate a dll and then load this from delphi. Yes, should be nice to' have a free version of commandline Delphi compiler.
精彩评论