C++

wwiki
이동: 둘러보기, 검색

extern[편집 | 원본 편집]

extern "C"[편집 | 원본 편집]

c와 c++에서 컴파일시 함수이름이 c++의 다형성으로 다르다. c와 c++을 혼용해서 사용한다면 다음을 선언하여 블록내의 함수를 c형태로 링킹되도록 한다.

#indef __cplusplus
extern "C"
{
#endif
#include <libavformat/avformat.h>
#indef __cplusplus
}
#endif

반대로 c++에서 c함수를 사용하기 위해서 다음과 같이 선언한다.

extern "C" void function();