www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - dflat - v0.1

After getting waylaid by jet lag, family, health, and debugging, 
I'm happy to finally announce v0.1 of dflat, a wrapping 
application/library for .net dlls (e.g C#) to generate the 
boilerplate needed to drive the CoreCLR (cross platform .Net 
implementation).

This release features:

* cross platform support by using Mono.Cecil
* the ability to call instance methods on classes
* simplified API - no need to use classes with auto-implement

The code is still very early (and liable to break) but it should 
be useable:

```c#
public class Class1
{
     int a;
     public Class1(int aa) { a = aa; }
     public void foo() { a = 42; }
     public override string ToString() { return a.ToString(); }
}
```

```d
auto a = Class1.make(314);
a.toString().fromStringz.writeln; // 314
a.foo();
a.toString().fromStringz.writeln; // 42
a.unpin(); // Objects created with make need their c# GC 
references unpinned manually to avoid leaking
```

It probably easiest to build it with `dub test -- 
/path/tocsharpcompiler/ /path/to/cecil/bin/ 
/path/to/derelict-util/source [dmd|ldc2...]`, until I figure out 
how to teach dub to compile c# and generate the deps.json and 
runtimeconfig.json

Please don't hesitate to file bug reports or feature requests!

This work has been sponsored by Symmetry Investments.

https://github.com/thewilsonator/dflat/
https://github.com/thewilsonator/dflat/releases/tag/v0.1-alpha1 
(best to use master though)
Jun 25