refactor: move utility functions out of the global namespace#1012
refactor: move utility functions out of the global namespace#1012wbruna wants to merge 1 commit into
Conversation
Many utility functions have generic names that may conflict with symbols from other libraries, causing linkage issues. fixes leejet#1011
There was a problem hiding this comment.
This is a .h file, not .hpp. There is no such thing as namespaces in C code. Maybe use #ifdef __cplusplus? Or use a prefix instead of a namespace.
There was a problem hiding this comment.
Actually the whole file contains c++ stuff like std::strings, nevermind. It should probably be a .hpp instad.
There was a problem hiding this comment.
Yeah, that is far from consistent right now. I believe stable-diffusion.h is the only file that's intended to keep compatibility with C.
|
This can only solve part of the symbol issues, and it makes the code a bit messy. I will refactor the relevant parts later. For now, I think we can just rename format in this PR. |
|
I added the |
Many utility functions have generic names that may conflict with symbols from other libraries, causing linkage issues.
The 'inline namespace' approach seems ideal for this case, since it's automatically added by any source code that includes
util.h. Moving the whole library to its own namespace would also work, of course.I kept the functions in place to avoid a huge diff, but they should probably be reorganized by visibility.
This is related to #967 , which I suggested for the same reason.
Should fix #1011 .