Pointer to callback function from C# to C++

  • Thread starter yaniv Abramovich
  • Start date
Y

yaniv Abramovich

Hi

I'm trying to Pass pointer to a callback function from C# to C++ it's
working ok for a few minuts and then it's stops.

can anyone help with that ?

public class PA_Client

{

private int lHandle;

public delegate int pPAEvent( int lEventCode,int lOperationCode,string
sData);

//PAHandShake

[DllImport(@"\PAApi.dll" ,CallingConvention=CallingConvention.Winapi

,CharSet=CharSet.None, EntryPoint = "PAMultiHandShake")]

private static extern int _PAHandShake(ref int lClientHandle,int
lOperationCode,string sServerAddress,pPAEvent pEventFunc);

//PARequest

[DllImport(@"\PAApi.dll",CallingConvention=CallingConvention.Winapi

,CharSet=CharSet.None,EntryPoint = "PAMultiRequest")]

private static extern int PARequest(int lClientHandle, int lOperationCode,
string sInputData);

//PAControl

[DllImport(@"\PAApi.dll",CallingConvention=CallingConvention.Winapi

,CharSet=CharSet.None, EntryPoint = "PAMultiControl")]

private static extern int PAControl(int lClientHandle,string sInputData);

{





public void Run_PA()

{



int Success = _PAHandShake(ref lHandle,1,address, new pPAEvent( Callback));

}

private int Callback(int opCode, int eventCode, string InputData)

{

//Do some thing

}



}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top