PDF version - ARM Information Center
PDF version - ARM Information Center
PDF version - ARM Information Center
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
C, C++ 및 어셈블리 언어 조합C 및 C++ 간에 참조 전달예제 4-16과 예제 4-17에서는 C 및 C++ 간에 참조를 전달하는 방법을 보여줍니다.예제 4-16 C++ 함수 정의extern "C" int cfunc (const int&) ;// Declaration of the C function to be called from C++extern "C" int cppfunc (const int& r) {// Definition of the C++ function to be called from C.return 7 * r;}int f () {int i = 3;return cfunc (i) ; // passes a pointer to 'i'}예제 4-17 C 함수 정의extern int cppfunc (const int*) ;/* declaration of the C++ function to be called from C */int cfunc (const int *p) {/* definition of the C function to be called from C++ */int k = *p + 4;return cppfunc (&k) ;}4-16 Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203IKNon-ConfidentialUnrestricted Access