Skip to content

Conversation

@wbruna
Copy link
Contributor

@wbruna wbruna commented Nov 26, 2025

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 .

Many utility functions have generic names that may conflict with
symbols from other libraries, causing linkage issues.

fixes leejet#1011
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the whole file contains c++ stuff like std::strings, nevermind. It should probably be a .hpp instad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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 this pull request may close these issues.

[Bug] Please consider renaming or inlining std::string format(const char* fmt, ...) in util.cpp, as it conflicts with llama.cpp def

2 participants