Feature Request: Support pointer APIs with explicit "spans" at call-site
Brief Summary of Request
Currently, passing pointers are not supported and for good reason.
But there may be a need to call a server function that operates using a C API.
By requiring the client to provide a span-like object instead of a raw pointer, we can have some safe control over the passing of "pointers".
What Is The Value Added With This Feature
Ability to call legacy/C functions
Possible Implementation
Create a span-like class that holds a pointer and extent.
It gets serialized as if it was an array/vector and can be de-serialized to a span or a raw pointer, depending on the usage.
It would also need to be re-bound like (non-const) references to update its values transparently.
Desired Outcome
// Server
int ReadValues(Value* ptr, size_t max_values);
// Client
Values arrValues[20];
client.call_func("ReadValues", rpc_hpp::wrap_array<Values>(arrValues), 20);
assert(arrValues[0].hasValue());
Other Details
- The span class should be able to take arrays and determine their size
- There should be a special type for a pointer to a single object (not an array)
- De-serializes to the object or raw pointer, depending on the usage.
Feature Request: Support pointer APIs with explicit "spans" at call-site
Brief Summary of Request
Currently, passing pointers are not supported and for good reason.
But there may be a need to call a server function that operates using a C API.
By requiring the client to provide a
span-like object instead of a raw pointer, we can have some safe control over the passing of "pointers".What Is The Value Added With This Feature
Ability to call legacy/C functions
Possible Implementation
Create a
span-like class that holds a pointer and extent.It gets serialized as if it was an array/vector and can be de-serialized to a span or a raw pointer, depending on the usage.
It would also need to be re-bound like (non-
const) references to update its values transparently.Desired Outcome
Other Details