added extern "C" wrapper within #ifdefs

wrapped the entire thing in extern "C" if compiling with C++, don't know why you would though.... since it's C code anyway.