LLVM BC as library

kinke noone at nowhere.com
Sun Oct 8 11:57:01 UTC 2017

On Sunday, 8 October 2017 at 10:30:22 UTC, Void-995 wrote:
> Some time ago I was able to compile simple library into BC 
> (pure C) and load it with my application and use across 
> different operating systems with re-compilation having those 
> external code running in a sandbox.
> How much difficult it would be to try with D? Means application 
> is in C++ and I want to load BC made from D code?
> The idea itself comes from something like sandboxed Quake 3 QVM 
> and used for game logic, it's pretty easy to replicate that 
> behavior with C/C++ with LLVM BC. I wonder how much pain it 
> would be to make that with D instead.

Compiling to LLVM bitcode with LDC is as simple as adding 
`-output-bc` to the command line. If you depend on the runtime 
library (druntime) and standard library (Phobos), you should be 
able to compile them to bitcode libraries by compiling LDC 
yourself using CMake option BUILD_BC_LIBS=ON.

More information about the digitalmars-d-ldc mailing list