![](/img/trans.png)
[英]Passing C# delegate with array reference to unmanaged code via function pointer
[英]Pointer to function for unmanaged code in C#
我有一個接受一個結構的DLL,該結構包含一個指向函數的指針來進行回調。
如何將IntPtr作為我的應用程序的函數來構建結構?
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class OPERATION {
public uint OperationID;
public IntPtr Context;
public IntPtr Callback; -> How to pass this?
}
這是委托接受OPERATION結構
public delegate void MY_CALLBACK([In] OPERATION operation, [In] uint msgId, [In] IntPtr msgDataPtr);
也許Marshal.GetFunctionPointerForDelegate方法可以幫助你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.