I have C function that calls pointer to function (with pointer to buf and size of buf)
printf("------------------------------\n");
printf("lengh of DATA_output = %zu\n", p->tot_len);
(*myStr.OnSendData)(buf, p->tot_len);
printf("------------------------------\n");
pointer to function defined like
typedef void (*pOnSendData)(void *buf, u16_t len);
Then my real c++ class method gets it through that pointer:
void Someclass::myPOnSendData(void *buf, u16_t len) {
std::cout << " Someclass::mypOnSendData len = " << (int)len << std::endl;
//Do something
}
The problem is that len
of buf
is pretty large.
output is :
------------------------------
lengh of DATA_output = 42
------------------------------
Someclass::myPOnSendData len = 50512
How could that be?