views:

151

answers:

3

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 are in the environment that move a virtual robot)

+5  A: 

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.

Mason Wheeler
+1  A: 

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.

Daniele Teti
+2  A: 

You should be able to do what you need to do using paxCompiler.

Jarrod Davis