extern c function

Oct 29, 2019 pm 04:17 PM
extern

extern c function

#extern The main function of "C" is to correctly implement C code to call other C language codes.

After adding extern "C", the compiler will be instructed to compile this part of the code in C language (not C). Since C supports function overloading, when the compiler compiles a function, it will also add the parameter type of the function to the compiled code, not just the function name; and the C language does not support function overloading, so compiling C The function of the language code does not include the parameter type of the function, generally only the function name is included.

This function is very useful, because before C appeared, many codes were written in C language, and very low-level libraries were also written in C language. In order to better support the original C code and the already written A good C language library needs to support C in C as much as possible, and extern "C" is one of the strategies.

This function is mainly used in the following situations:

1. C code calls C language code;

2. In the C header file Use;

3. When multiple people collaborate on development, some people may be better at C language, while others are good at C. It will also be useful in this case.

Recommended tutorial: C language tutorial

The above is the detailed content of extern c function. For more information, please follow other related articles on the PHP Chinese website!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to add next-level C compiler How to add next-level C compiler Mar 03, 2025 pm 05:44 PM

How to add next-level C compiler

Method of copying code by C language compiler Method of copying code by C language compiler Mar 03, 2025 pm 05:43 PM

Method of copying code by C language compiler

What are the web versions of C language compilers? What are the web versions of C language compilers? Mar 03, 2025 pm 05:42 PM

What are the web versions of C language compilers?

What are the alternatives to NULL in C language What are the alternatives to NULL in C language Mar 03, 2025 pm 05:37 PM

What are the alternatives to NULL in C language

Which C language compiler is better? Which C language compiler is better? Mar 03, 2025 pm 05:39 PM

Which C language compiler is better?

C language online programming website C language compiler official website summary C language online programming website C language compiler official website summary Mar 03, 2025 pm 05:41 PM

C language online programming website C language compiler official website summary

Is NULL still important in modern programming in C language? Is NULL still important in modern programming in C language? Mar 03, 2025 pm 05:35 PM

Is NULL still important in modern programming in C language?

C language compiler installation tutorial (computer version) C language compiler installation tutorial (computer version) Mar 03, 2025 pm 05:41 PM

C language compiler installation tutorial (computer version)

See all articles