Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef struct
- {
- ...
- } Foo;
- void do_smth(Foo *obj, unsigned char *data)
- {
- ...
- }
- void loop(int handle, void (*handler)(unsigned char *, const unsigned char *), unsigned char *user)
- {
- ...
- }
- void handler_func(unsigned char *user, const unsigned char *data)
- {
- Foo *obj;
- obj = (Foo *)user;
- do_smth(obj, data);
- }
- int main(void)
- {
- Foo *obj = malloc(sizeof(Foo));
- int handle = 1;
- loop(handle, handler_func, (unsigned char *)obj);
- free(obj);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement