Current location - Quotes Website - Signature design - Can a C++ dynamic link library have two functions with the same name? What about a static link library? Can it have two functions with the same name?
Can a C++ dynamic link library have two functions with the same name? What about a static link library? Can it have two functions with the same name?

A single dynamic library can have two functions with the same name, but they cannot be exported at the same time, otherwise an error will occur. Different dynamic libraries can have functions with the same name, and there will be no problem loading them at runtime. However, specifying them at compile time will cause unexpected problems. Running results.

A single static library can have functions with the same name, but some compilers do not support it. Different static libraries can also have functions with the same name, but if the function signatures are consistent, compilation errors will occur when using them.