Thread overview
Runtime execution
Oct 19, 2014
Bauss
Oct 19, 2014
Marco Leise
Oct 19, 2014
Mjkp
October 19, 2014
Is there anyway to pull of a runtime compilation of D code or at the very least asm execution?
October 19, 2014
Am Sun, 19 Oct 2014 06:55:17 +0000
schrieb "Bauss" <jj_1337@live.dk>:

> Is there anyway to pull of a runtime compilation of D code or at the very least asm execution?

Sure. For runtime compilation you invoke any installed D compiler and compile a conventional shared library that you then load with: http://dlang.org/library/core/runtime/Runtime.loadLibrary.html

For ASM execution you'd simply load the ASM into an executable memory area (See virtual memory page protection attributes for your OS) and call or jump into it through D's inline asm {} blocks.

I hope that helps.

-- 
Marco

October 19, 2014
On Sunday, 19 October 2014 at 06:55:18 UTC, Bauss wrote:
> Is there anyway to pull of a runtime compilation of D code or at the very least asm execution?

You can call dmd using std.process to compile a D plug-in edited in your D program and dynamic link the output .dll or .so just after the dmd process 's successfully returned.