fixed the linking error

It was necessary to include 'extern C { ... }' because the code mixes C and C++ libraries.
Check http://www.parashift.com/c++-faq/include-c-hdrs-personal.html for more details.