Don't use std::function
eyalroz opened this issue · comments
std::function is a heavy container, whose main use is encapsulating potentially complex invokable objects. See this discussion; why use it? A simple (typed) function pointer should probably do nicely.
Hello, I just made your requested changes on #21
Feel free to make a review on those changes, after what i will merge them
Hello,
I made new changes on #21
I removed get_function
and get_variable
and replaced them with get_symbol
instead:
T &dylib::get_symbol<T>(const char *)
This will do the job for both functions and variables.
I also updated the documentation regarding that.
I think this way will be cleaner but I would like to have your opinion on that.
Since we will need to make breaking changes with this issue (#18) it would be an opportunity to do the same regarding this
I am actually not entire sure that it's better to "roll everything up" into a single function. It has some elegance benefit, but what if, in the future, you wanted to differentiate their behavior somehow? But maybe that's not interesting/not relevant. Like I said, no strong opinion.