delphi 如何将DllGetClassObject编写为C#委托?

dpiehjr4  于 12个月前  发布在  C#
关注(0)|答案(1)|浏览(167)

有一个用 Delphi 写的导出dll方法:DllGetClassObject:function(const CLSID,IID:Tencent; var Obj):HResult; stdcall;
我需要用c#写一个等价的方法作为委托。它应该是什么样子?

6qfn3psc

6qfn3psc1#

就像这样:

[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate uint DllGetClassObjectDelegate(
    [MarshalAs(UnmanagedType.LPStruct)]
    Guid rclsid,
    [MarshalAs(UnmanagedType.LPStruct)]
    Guid riid,
    [MarshalAs(UnmanagedType.IUnknown, IidParameterIndex=1)]
    out object ppv
);

字符串
来源:http://blog.kutulu.org/2012/01/com-interop-part-9-custom-activations.html?m=1

相关问题