Is it possible to use DMD as a library to compile strings at runtime?

Andre Pany andre at s-e-a-p.de
Sat Feb 1 20:01:34 UTC 2020


On Friday, 31 January 2020 at 11:19:37 UTC, Saurabh Das wrote:
> I see that DUB has DMD as a library package, but I was not able 
> to understand how to use it.
>
> Is it possible to use DMD as a library within a D program to 
> compile a string to machine code and run the compiled code at 
> runtime?
>
> Thanks,
> Saurabh

Another approach:
- include the dmd compiler package with your application
- within your app call the compiler executable and compile the 
source code to a dll / so
- call the dll / so function

Maybe you will get some trouble with AV software with this 
approach...

Kind regards
Andre



More information about the Digitalmars-d-learn mailing list