Does extern “C” have any effect in C?

后端 未结 3 1958
既然无缘
既然无缘 2021-02-13 10:03

I just got some C code that uses extern \"C\" to declare external functions like this:

extern \"C\" void func();

Is this valid C? I\'m getting

3条回答
  •  忘了有多久
    2021-02-13 10:53

    Not valid in C. If present after preprocessing this will result in a diagnostic as per the standard.

    For C++, this turns of name-mangling. See this for more details as to why it may be required. Can you post some more details?

提交回复
热议问题