10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

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-8과 예제 4-9에서는 C++에서 C를 호출하는 방법을 보여 줍니다.예제 4-8 C++에서 C 함수 호출struct S {// has no base classes// or virtual functionsS (int s) : i (s) { }int i;};extern "C" void cfunc (S *) ;// declare the C function to be called from C++int f () {S s (2) ;// initialize 's'cfunc (&s) ; // call 'cfunc' so it can change 's'return s.i * 3;}예제 4-9 C에서 함수 정의struct S {int i;};void cfunc (struct S *p) {/* the definition of the C function to be called from C++ */p->i += 5;}4-12 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!