Call D code from C#

John Colvin john.loughran.colvin at gmail.com
Thu Jan 9 08:05:48 PST 2014


On Thursday, 9 January 2014 at 15:58:20 UTC, anthony wrote:
> Hi to all here,
>
> (another one here that wants to desperately use D in his work 
> environment!)
>
> So, I am a C# and C++ guy who is used to high quality tools and 
> UI libraries. I discovered VisualD and I settled on using it, 
> it is really awesome!
>
> The only problem that concerns me is the lack of a UI library 
> to use with the language. GTK+ is not an option for me. Qt is 
> but I do not see any way to use it from D.
>
> I am thinking about using D for the business logic of my 
> programs (let's say on Windows, for start) and then C# for the 
> UI stuff.
>
> Is there a way to access D code from C# ? Some path I need to 
> follow, some hint... ?
>
> Thanks a lot for any help !
>
> anthony

C# should be able to call any D functions declared with extern(C) 
by compiling the D code as a shared library or dll and using C#'s 
PInvoke tool just like you would for C.

Be aware that you will need to initialise the D runtime 
(core.runtime.rt_init).

Also, loading multiple shared libs / dlls will cause pain.


More information about the Digitalmars-d-announce mailing list