cannot call function pointer from tcp_recv_cb
Posted: Mon Feb 08, 2016 7:12 pm
I'm curious if there are any know issues with calling a function pointer from an event callback. In this case I'm trying to call from a `espconn_regist_recvcb` callback. In my `user_main` I can check the memory address of the actual function, and the pointer to it and they match. 0x40244eb4. I then pass a pointer to the structure that contains it to another function, the pointer is saved in a reference in that library. I can check the value of this pointer, it matches the address of the actual struct, 0x3ffffac0 and the function pointer still points to the correct address. 0x40244eb4.
Now my tcp_recv_cb gets call on the arrive of a packet and I would expect that function pointer to still point at 0x40244eb4... nope, it's now 3. Simply.... 3.
I know it's hard to judge without seeing code, I'm working on a reduced test case but maybe someone can explain some nuance of calling function pointers from other function pointers I've missed.
Now my tcp_recv_cb gets call on the arrive of a packet and I would expect that function pointer to still point at 0x40244eb4... nope, it's now 3. Simply.... 3.
I know it's hard to judge without seeing code, I'm working on a reduced test case but maybe someone can explain some nuance of calling function pointers from other function pointers I've missed.