Closed ghost closed 5 years ago
This is probably because the vector is made (and should be destroyed) outside of the function send_Vector()
. By passing the vector as is, the destructor is called when the function ends, the calling function will additionally call the destructor, which leads to undefined behaviour.
My guess is that by passing the vector by reference solves the problem, i.e.,
Vector <uint8_t>send_Vector(Vector <uint8_t>&data) { ... }
Does this help?
By the way, your return type (Vector) does not seem to match the type of the value you return (uint8_t).
There are some examples on complex data structures in the online example. Perhaps that helps.
Yes, passing a reference solved this problem. Many thanks!
Other than that I had no issues - with simpleRPC, that is ...
Thanks for the feedback.
I'm getting heap corruption when passing Vector arguments to functions called by simpleRPC.
Setting Vector.destroy = false in function void _read(Vector *data) in read.tcc appears to fix the problem, although this may (will?) result in a memory leak.
Test code (snippet):