-
Notifications
You must be signed in to change notification settings - Fork 164
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
Consider prefixing public functions with unique namespace #67
Comments
Hi, thanks for the suggestion. Currently, this library claims the Changing the prefix would break API compatibility, and while I am not opposed to that as long as it's accompanied by a major version change, I'm hesitant to do it unless necessary. As a thought exercise, I tried to come up with a few alternative prefixes, but they all seem poor. Possibly this can be solved/fixed in the future when the library switches to building with Cmake, it might make it easier to configure a custom namespace. |
Yeah, I was unable to think of a good suggestion for a generic prefix as How about an optional configuration define or macro which would prefix the functions accordingly if it is set by the user? Then you don't have to change the default API and users of the library can then pick any prefix they want. I know rapidjson uses this method to allow its users to namespace the entire codebase (its C++ but same concept I think). |
That sounds like a reasonable solution. However at this point it's hard to implement, because of the archaic way that the build system handles symbol visibility. All visible symbols are currently enumerated in exports.txt, which is a static textfile. So the plan is to move the library to a Cmake-based build system. That would remove a lot of the build cruft and replace it with new cruft, and would presumably make it easier to add this sort of customization. Would you be OK if I leave this issue open, but not resolve it for the time being? |
Yes, that sounds good to me. Thanks. |
I ran into an interesting issue where linking a project with libmysql.a as well as this library caused some extremely weird behavior, and eventually I found out there was a namespace clash as mysql also declares two functions
base64_encode()
andbase64_decode()
. Please considering prefixing your library C functions with a unique namespace. I've gotten around this by forking and just naming them differently for now but I want to say thanks for the great library, I've enjoyed using it. I'd also make a PR but I don't know what you'd want to prefix with and it is a breaking change to the API.The text was updated successfully, but these errors were encountered: