callBack
by subrahmaniam from LinuxQuestions.org on (#4T026)
Hi,
Below is a program for call back function. no compilation errors. But not entering into call back function (mcancallBack).I set variable reason to 0. I am trying to test the interrupt based callback. I could not find the mistake in this . please guide me to resolve this issue.
Thanks and regards,
K Subrahmaniam
#include <stdio.h>
#include<unistd.h>
#include<stdlib.h>
typedef void (*CANFD_DataAppCallBack)( int reason);
typedef struct temp
{
CANFD_DataAppCallBack callBack;
} x;
static void mcancallBack(int reason)
{
printf("reason is %d\n",reason);
if(reason==0)
printf("This is callback\n");
}
int reason;
x *ptr;
int main()
{
ptr= calloc (1, sizeof(*ptr));
reason =0;
ptr->callBack=mcancallBack;
free(ptr);
return 0;
}


Below is a program for call back function. no compilation errors. But not entering into call back function (mcancallBack).I set variable reason to 0. I am trying to test the interrupt based callback. I could not find the mistake in this . please guide me to resolve this issue.
Thanks and regards,
K Subrahmaniam
#include <stdio.h>
#include<unistd.h>
#include<stdlib.h>
typedef void (*CANFD_DataAppCallBack)( int reason);
typedef struct temp
{
CANFD_DataAppCallBack callBack;
} x;
static void mcancallBack(int reason)
{
printf("reason is %d\n",reason);
if(reason==0)
printf("This is callback\n");
}
int reason;
x *ptr;
int main()
{
ptr= calloc (1, sizeof(*ptr));
reason =0;
ptr->callBack=mcancallBack;
free(ptr);
return 0;
}