D语言的简捷很让人着迷,对于一些用C#写的老代码,想用D写成dll,来提高一下效率。
本文用一个简单例子来展现一下c#调用d的dll。
1、D代码:
mydll.d:
module mydll;
import std.stdio;
import std.file;
import std.string;
public struct Struct1
{
protected int a;
protected ulong b;
protected immutable(char)* c;
}
public struct Struct2
{
protected int a;
protected ulong b;
}
export extern(C) void dllprint(ref int a,ulong b,immutable(char)* str,out wchar* strref,Struct1 struct1,ref Struct2 struct2)