The callback function has the following format. You can specify any name for this function.
public void CallBackProc(short Id, int wParam, int lParam, void * Param);
Unsafe context is required for any operation involving pointers.
Add the unsafe keyword to the created callback routine.
unsafe public void CallBackProc(short
Id, int wParam, int lParam, void *Param)
{
・
・
・
In Visual C#, please use delegate to handle a function pointer.
The delegate declarations for each callback routine are written in the CcanCs.cs file.
Notify that there is received data |
PEVENTCALLBACK |
Please use the following function to register callback function.
Notify that there is received data |
CanNotifyEvent |
- Initializing delegate
- Obtain GCHandle for interrupt handling delegate to prevent garbage collection
- Get the fixed pointer of the interrupt handler delegate
- Register the obtained fixed pointer using the callback function registration function CanNotifyEvent
- Release the GCHandle for the interrupt handling delegate when it is no longer needed (such as when the application ends)
For the details of coding, please refer to sample programs and Note of Using Visual C#.