On Wednesday, 21 August 2013 at 09:23:27 UTC, Jacob Carlborg wrote:
On 2013-08-21 11:10, Flamaros wrote:

For the moment we can't use D as script language for our project, just because there is no API to parse and execute a d file as script.

You can do something like this:

import dquick.dsl;
import std.stdio;

void executeSciprt ()
{
    mixin(import("foo.d"));
}

void main ()
{
    initialize();
    executeSciprt();
    writeln(DQuickDsl.serialize());
}

When you want to "execute" the D script you use the above as a template and only need to replace the file name, in this case "foo.d", and create a file. Compile that file run the resulting executable, this is easily done using rdmd. Retrieve the serialized data, deserialized it and do want you need with the data structures.

Maybe something can be done with a load of a compiled dll resulting of the compilation of script files. But it doesn't seems to be a really good way.

I am not sure to understand correctly your suggestion, I don't see how the application will be able to create GUI items from "foo.d". Need "foo.d" embed a code to serialize the GUI items structure to a file that the application will load?

Reply via email to