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

Use dlopen for dynamic libraries #3

Open
Unesty opened this issue Oct 22, 2020 · 4 comments
Open

Use dlopen for dynamic libraries #3

Unesty opened this issue Oct 22, 2020 · 4 comments

Comments

@Unesty
Copy link

Unesty commented Oct 22, 2020

Currently it doesn't run without some library, even if it is unused. Recompilation required to avoid that, but it takes time.

@nyorain
Copy link
Owner

nyorain commented Oct 22, 2020

Yes I see how this might be useful. I'm not sure it's worth the effort though, we would have to load a lot of libraries and functions on some backends (think of all the different xcb libs, for instance). Will probably not find time to implement it myself (don't have a usecase for it myself) but would not be opposed to a PR.

@Unesty
Copy link
Author

Unesty commented Oct 22, 2020

Into which functions dlopen and dlclose must be inserted?

@nyorain
Copy link
Owner

nyorain commented Oct 24, 2020

Well, when creating a display (e.g. swa_display_x11_create) you would have to dlopen all needed libraries by that backend and build an internal symbol table using dlsym (depending on the way you define it you likely also have to change every place any of the library functions are called to use the internal function pointers instead). It's quite some work.

@nyorain
Copy link
Owner

nyorain commented Oct 24, 2020

Maybe you can find a way to tell the linker to "not link against the library directly, let the symbols be resolved when dlopen is called" and then just call dlopen on display creation. But this is highly compiler and platform specific, I don't think everything supports it. Btw, I'm assuming you working on unix/linux, on windows this whole thing does not really make sense (except maybe for libGL).

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