Arthur
Arthur

Reputation: 3418

Is dynamic class loading possible in delphi

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)

Upvotes: 3

Views: 594

Answers (3)

Jarrod Davis
Jarrod Davis

Reputation: 21

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

Upvotes: 2

Daniele Teti
Daniele Teti

Reputation: 1774

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.

Upvotes: 1

Mason Wheeler
Mason Wheeler

Reputation: 84590

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.

Upvotes: 5

Related Questions