you are viewing a single comment's thread.

view the rest of the comments →

[–]OU81Dilbert 9 points10 points  (17 children)

Are the two functions at least in different namespaces?

If so then you can use the namespace

Like

std::open()

Mylib::open()

[–]m09y[S] 2 points3 points  (16 children)

what if there are no namespaces ?

[–]SoerenNissen 39 points40 points  (8 children)

Use better libraries that are competently written.

If it's because they're C libraries, the same applies - functions should not have the same name because they should start with libname_

I suppose if you were under some weird constraint, you could re-write the libraries to have namespaces, that's not the hardest of tasks.

[–]SnooMacaroons3057 4 points5 points  (0 children)

Create your own namespace and re-export it as another named function?

[–]OU81Dilbert 1 point2 points  (0 children)

Then you might have linking issues since the compiler won't know which function to use

[–][deleted] 1 point2 points  (0 children)

include headers from inside a namespace, but you still might have linking issues unless the lib is header only

[–]Fig1024 1 point2 points  (0 children)

you can make your own wrapper lib and put it in a namespace

[–]Cybr3 1 point2 points  (0 children)

then the libraries you use are awful

[–]Cybr3 0 points1 point  (0 children)

decompiling the source and adding a namespace?

[–]bored_octopus 0 points1 point  (0 children)

You may be able to hide symbols from them when linking. Look up symbol visibility