I'm looking at this kind of line, which we would now write with dylib (2.0):
auto mod = lib.get_function<float *, const char *>("driver::factory");
I find that's not good enough. It's neither here nor there. If you want something fully dynamic, then don't even pass the type via a template, but as a string, e.g.
I'm looking at this kind of line, which we would now write with dylib (2.0):
I find that's not good enough. It's neither here nor there. If you want something fully dynamic, then don't even pass the type via a template, but as a string, e.g.
where users would manage the calling conventions themselves using a
void*
.Similarly, you would also accept
for any foo, i.e. be willing to ignore the return type in the string (but also to check it if that's at all possible).
However, if you do have the namespace, name and signature at compile-time, then I would expect something like:
But I'm not sure the latter can be easily implemented in C++. Perhaps a macro would help here (allowing us to use both the value and the name.