C# to D calling
Daniel Keep
daniel.keep.lists at gmail.com
Fri May 18 19:27:42 PDT 2007
BCS wrote:
> Has anyone gotten c# code to call D code? Loading a D dll with a c api
> is good enough. Going the other way might also be of interest to me.
Sadly, I'm not sure if I even have cs installed anymore... D kinda got
in the way :P
Calling D code from C#, I imagine, would be the same as trying to call a
D DLL from any other language that can do C functions; just make sure
you init the GC, module ctors, etc.
Going the opposite way, you have two options AFAIK: one is to expose the
C# class using COM and then using IUnknown from D. The other is to
actually embed the .NET runtime into your app, but I'm not sure exactly
what you can do with that.
Here's a short CodeProject article on the first (using C++, tho):
http://www.codeproject.com/csharp/ManagedCOM.asp
-- Daniel
--
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
http://xkcd.com/
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d-learn
mailing list