Home > Backend Development > C++ > body text

Why use extern 'C' in C++ code?

WBOY
Release: 2023-09-13 12:17:04
forward
758 people have browsed it

为什么在C++代码中使用extern "C"?

In C, you need to use extern "C" when declaring a function that is implemented/compiled in C.

Using extern "C" lets the compiler know that we want to use C's naming and calling conventions. This puts the compiler into a C-mode-like state inside our C code. This is necessary because the C compiler obfuscates the names differently in its symbol table and therefore behaves differently than the C compiler.

The above is the detailed content of Why use extern 'C' in C++ code?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!