Aha, it was the missing #ifdef __cplusplus around the extern "C" declaration