Dynamic binding to the Mono runtime API

Adam Wilson via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Jun 3 22:47:32 PDT 2017


On 6/3/17 10:30, Jakub Szewczyk wrote:
> Mono runtime is a cross-platform, open-source alternative to Microsoft's
> .NET framework [1], and it can be embedded in other applications as a
> "scripting" VM, but with JIT-compilation enhanced performance and
> support of many languages such as C#, F# or IronPython [2].
> It provides a C API, so I've bound it to D as a Derelict-based project,
> available at https://github.com/kubasz/derelict-mono, and as a DUB
> package (http://code.dlang.org/packages/derelict-mono). It currently
> wraps the Mono 5.0 API.
> There's also a simple example of calling a C# main from D code, and C#
> code calling a native function implemented in D.
>
> PS: Because I don't own a Mac I have no idea what the correct paths to
> the Mono shared library are, so it'd be great if someone could
> post/create a PR of them.
>
> [1] http://www.mono-project.com/
> [2] http://www.mono-project.com/docs/advanced/embedding/scripting/

I work with C# professionally and this is some SERIOUSLY cool work. 
Thank you for this!

I've looked over the code a bit and I have a couple of questions.
This appears to be an interface to the runtime itself, not a BCL 
interface correct?
It looks like this could be used to could this be used to read into a 
Mono Class Libraries, and if so would so some sort of automated code 
generation tool be required? It looks to me like the binding will be 
non-trivial, with GC, exceptions, etc. that all need to be handled at 
the call-site.
Can we get a static library version of this, or is there a dependency on 
dynamic libraries?

I have to admit I am very impressed. I have spent a lot of time building 
code generators before and I have to admit that the idea of binding to 
arbitrary .NET libraries via code generation is extremely appealing to 
me. I am seriously tempted to take this and start building a binding 
generator...

I seriously need more free time! Way too many cool and useful things 
happening in D for my limited free time. A D binding for XAML ... THAT 
would sight to behold!

-- 
Adam Wilson
IRC: LightBender
import quiet.dlang.dev;


More information about the Digitalmars-d-announce mailing list