Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use std::function #20

Closed
eyalroz opened this issue May 10, 2022 · 4 comments · Fixed by #21
Closed

Don't use std::function #20

eyalroz opened this issue May 10, 2022 · 4 comments · Fixed by #21
Assignees
Labels
enhancement New feature or request

Comments

@eyalroz
Copy link
Contributor

eyalroz commented May 10, 2022

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.

@martin-olivier martin-olivier self-assigned this May 11, 2022
@martin-olivier martin-olivier added the enhancement New feature or request label May 11, 2022
@martin-olivier martin-olivier linked a pull request May 11, 2022 that will close this issue
4 tasks
@martin-olivier
Copy link
Owner

Hello, I just made your requested changes on #21
Feel free to make a review on those changes, after what i will merge them

@martin-olivier
Copy link
Owner

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

@eyalroz
Copy link
Contributor Author

eyalroz commented May 13, 2022

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.

@martin-olivier martin-olivier linked a pull request May 28, 2022 that will close this issue
4 tasks
@martin-olivier
Copy link
Owner

Hello,
Finally, i kept the original names get_function and get_variable to be able to make specific variable / function mangling for this issue #27.
get_function now returns a function reference instead of an std::function

Merged into dev branch at a3ef5e7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants