Hm, but that would put "my_conflicting_function_from_lib1" into namespace "Lib1" while the actual "conflicting_function_from_lib1" still would not be in a different namespace and would conflict with a function of the same name from, say, lib2 --- or am I missing something here?
Even worse: If I understand what I read properly all functions in any 'extern "C"' blocks share the same namespace (if they're linked together), so there can never be any two c functions with the same name? (See e.g. https://stackoverflow.com/questions/28996944/extern-c-linkage-inside-c-names...).
Am 20.11.2017 um 01:16 schrieb Marc Jeanmougin:
I thought about something more like
wrapperlib1.h: #include <lib1>
namespace Lib1 { void my_conflicting_function_from_lib1(args){ return conflicting_function_from_lib1(args); } }
On 11/20/2017 01:07 AM, Eduard Braun wrote:
Am 19.11.2017 um 23:19 schrieb Marc Jeanmougin:
You can probably wrap one (or both) of them in a namespace (or class) in a separate .h file containing just the include to one lib and definitions of (used|all) functions in the lib, calling the lib, and include that .h file instead of the library one. (Not very practical, I know)
Are suggesting something like?
wrapper.h: namespace custom { #include <library1.h> }
I read about that before but it was specifically advised against (because it might cause even more issues while not really solving the problem at hand), e.g. https://stackoverflow.com/questions/6670738/is-it-a-good-idea-to-wrap-an-inc...
The fact that I wasn't able to find any satisfying solution at all (except changing the library source) was the reason to ask here, so if I misunderstood and you had something different in mind please let me know!
Regards and thanks for your answer Eduard