#if defined(__cplusplus) extern "C" { #endif int foo(); #if defined(__cplusplus) } #endif