friend 로 걸린 함수가 extern "C"인데 어떻게 해야하나요.
글쓴이: purewell / 작성시간: 화, 2006/02/07 - 6:11오후
class myclass { friend void myfunc(int* c); // skip... }; extern "C" void myfunc (int* c) { // skip... }
이렇게 하면 컴파일오류 뜹니다.
아래는 MSDN 검색 결과입니다.
Quote:
Compiler Error C2732Error Message
linkage specification contradicts earlier specification for 'function'The function is already declared with a different linkage specifier.
This error can be caused by include files with different linkage specifiers.
Change the extern statements so that the linkages agree.
Example
The following sample generates C2732:Copy Code
// C2732.cpp
extern void func( void ); // implicit C++ linkage
extern "C" void func( void ); // C2732
friend는 extern과 동일한 효과를 가진다고 하는데,
extern "C++"로 내용을 서술해주면 정상 작동하지만,
문제는 꼬~옥 extern "C"로 노출(아이 부끄...)해야합니다.
(결국 name mangling을 적용하고 싶지 않아서입니다. dll같은 공용객체니깐)
우짜쓸까요.
Forums:
ㅡ_-) 자문자답입니다.표준인지는 모르겠지만,[code:1
ㅡ_-) 자문자답입니다.
표준인지는 모르겠지만,
_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz
표준 맞습니다. 다른 방법으로 간단한 wrapper를 쓸 수도 있습니다.
표준 맞습니다. 다른 방법으로 간단한 wrapper를 쓸 수도 있습니다.
> o<)o 감사합니다.
> o<)o 감사합니다.
_____________________________
언제나 맑고픈 샘이가...
http://purewell.biz
댓글 달기