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

Set log callback #998

Closed
Switch0621 opened this issue May 15, 2024 · 2 comments
Closed

Set log callback #998

Switch0621 opened this issue May 15, 2024 · 2 comments

Comments

@Switch0621
Copy link

Switch0621 commented May 15, 2024

Hi guys, please, advice me. I want to invoke alsoft_set_log_callback for set my callback but compeler send exception "Unable to find entry point...". I run command nm -D libopenal.so.1 but has no the function in the list. I configure and generate .so with CMake without any changes. What i do wrong?

@kcat
Copy link
Owner

kcat commented May 16, 2024

Hi. You need to call alcGetProcAddress(NULL, "alsoft_set_log_callback") to get the function dynamically, to avoid failures when attempting to loading the library in case it doesn't exist. An app can still work fine if the function doesn't exist, since it just means your callback won't be called with messages to log.

typedef void (ALC_APIENTRY*LPALSOFTLOGCALLBACK)(void *userptr, char level, const char *message, int length) ALC_API_NOEXCEPT17;
void (ALC_APIENTRY *p_alsoft_set_log_callback)(LPALSOFTLOGCALLBACK callback, void *userptr) ALC_API_NOEXCEPT17;

...

p_alsoft_set_log_callback = alcGetProcAddress(NULL, "alsoft_set_log_callback");
if(p_alsoft_set_log_callback)
    p_alsoft_set_log_callback(...);

@Switch0621
Copy link
Author

thank you very match!

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

No branches or pull requests

2 participants