//core. H
The namespace Core {
Public ref class Live
{
Public:
The delegate void SucDelegateCallBack (void * data);
Void init (SucDelegateCallBack ^ suc);
};
}
//core. CPP
The namespace Core {
Void Live: : init (SucDelegateCallBack ^ suc) {
//SDK header files relevant content:
//typedef void SucCallback (*) (void * data);
//virtual void init (SucCallback suc=NULL)=0.
//want to implement the following ideas, but don't know how to transfer suc SucCallback
GetCore () - & gt; Init (SucDelegateCallBack);//this is false: wrong parameter type
}
}
How to SucDelegateCallBack into SucCallback?
CodePudding user response:
Has been solved!IntPtr IP=Marshal: : GetFunctionPointerForDelegate (suc);
SucCallback cb=static_cast & lt; SucCallback> (IP) ToPointer ());
CodePudding user response:
Thank you, learn a simple call the delegate