Thank you,
Yes that would be possible but:
- It would require the user of my library to do the string creation OR use an awkward interface for specifying the type of function when registering it.
- It would be less bandwidth efficient.
How could I copy an arbitrarily long piece of data to the parameter list? If I know this I can decide on the method to use (string or other method), or possibly decide to simplify the RPCs.
I've been messing with variable argument lists, without success.
I've also tried passing a whole array, but it doesn't seem to copy the array. I don't know how this works in C++.
Is there some way to create an arbitrarily sized datatype at runtime?
EDIT:
Got it to work:
Code:
typedef void (*func)( ... );
unsigned char c[8] = {0,0,0,0,0,0,0,0}; // dummy of the incoming parameter data
struct {char x[8];} a;
memcpy(&a, c, 8);
(*myFunc)(a);
EDIT2: damn, I cannot make the length of the array inside the struct a variable...