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

Conflicting declaration of windows_error_str with libusb #269

Closed
rasky opened this issue Jul 11, 2022 · 5 comments
Closed

Conflicting declaration of windows_error_str with libusb #269

rasky opened this issue Jul 11, 2022 · 5 comments

Comments

@rasky
Copy link
Contributor

rasky commented Jul 11, 2022

Hello, it looks like both libwdi and libusb define a function with the same name (windows_error_str):

https://github.com/libusb/libusb/blob/c060e9ce30ac2e3ffb49d94209c4dae77b6642f7/libusb/os/windows_common.c#L48

char *windows_error_str(DWORD retval)

This means that it seems not possible to create a single binary that both links libwdi and libusb, because the linker will complain that there are multiple definitions of that symbol.

It seems that, in both cases, the symbol is actually not meant to be exported, but just referenced internally across different files. Maybe it should renamed with a prefix to avoid the clash (eg: wdi_windows_error_str).

@pbatard
Copy link
Owner

pbatard commented Jul 11, 2022

I'm afraid that, since both projects are Open Source, I consider that if you plan to create a libusb + libwdi executable, you will have no issues renaming one of these instances for your project.

Very, very few people are developing projects that link libwdi and libusb in the same executable, so, right now, I'm not planning to spend any time to address a very corner case, sorry.

@pbatard pbatard closed this as completed Jul 11, 2022
@rasky
Copy link
Contributor Author

rasky commented Jul 11, 2022

Sure, this is what I did locally. Would you accept a PR that fixes this by renaming the function?

BTW since I'm a beginner in this world, would you explicitly suggest against linking both libwdi and libusb in the same executable for technical reasons? Or is it just something that is not common but there are not technical issues in doing it?

@pbatard
Copy link
Owner

pbatard commented Jul 11, 2022

A PR should be okay. And yes, a wdi_ prefixed name is what I'd prefer.

I don't explicitly suggest against linking both libraries, it's just that you usually want to keep the driver installer and the application separated, therefore very few people are expected to want to combine both libraries.

@rasky
Copy link
Contributor Author

rasky commented Jul 11, 2022

Thanks for the clarification. I will prepare the PR after testing.

@pbatard
Copy link
Owner

pbatard commented Jul 11, 2022

Appreciated. Thanks!

rasky added a commit to rasky/libwdi that referenced this issue Jul 11, 2022
pbatard pushed a commit that referenced this issue Jul 25, 2022
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

Successfully merging a pull request may close this issue.

2 participants