c - Can typedef structures cause name clashes when linking a static library? -


When I create a static library, can the name of the typeface structure be conflicts?

Looking at the example header, the file below, I think myFun () will be an external symbol and any other library with myFun () function Can fight with. To avoid this, the best part is that myFun () give a longer and more specific name.

  // myFile.h typedef struct {int myVar; } MyStruct; Zero myFun (myStruct * input);  

Is myStruct an external symbol that can cause naming conflicts while linking to another library?

And why is it not listed when I .a to nm myLib.a ?

No, names appear outside of the linkage only outside the library (or source file), and C There is no relation between types. C11 §6.2.2 / 2:

In the set of translation units and libraries, a complete program is formed, with the external relation, each declaration of a specific identifier is the same object or function Reflects.

In C ++, you will cause concern in theory, because class types and typed names are declared together, type of class, regard however, behavior Linking them will not see them.

So, there really is nothing to worry about.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -