10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C, C++ 및 어셈블리 언어 조합C에서 C++ 호출예제 4-12와 예제 4-13에서는 C에서 C++를 호출하는 방법을 보여 줍니다.예제 4-12 C++에서 호출되도록 함수 정의struct S { // has no base classes or virtual functionsS (int s) : i (s) { }int i;};extern "C" void cppfunc (S *p) {// Definition of the C++ function to be called from C.// The function is written in C++, only the linkage is C.p->i += 5;}예제 4-13 C에서 함수 선언 및 호출struct S {int i;};extern void cppfunc (struct S *p) ;/* Declaration of the C++ function to be called from C */int f (void) {struct S s;s.i = 2; /* initialize 's' */cppfunc (&s) ; /* call 'cppfunc' so it *//* can change 's' */return s.i * 3;}4-14 Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203IKNon-ConfidentialUnrestricted Access

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!