LLVM BC as library

Void-995 void995 at gmail.com
Sun Oct 8 12:12:10 UTC 2017


On Sunday, 8 October 2017 at 11:57:01 UTC, kinke wrote:
> 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.
I think second part was most important information, thank you. 
Can I build Phobos partly (or just runtime)? I would like to 
expose my own API for file system, for example, meaning 
restricting usage of built-in IO, same goes for allocations.




More information about the digitalmars-d-ldc mailing list