Take the 2-minute tour ×

I am writing a managed wrapper for a 3rd party API and I have access to only their header files and .lib file. In one of the header files there is a function:

extern "C" void functionName(unsigned int param);

To wrap this function, I can ignore the extern keyword right? It is just to tell the compiler to treat the declaration as if it were made in C, rather than C++ and I guess this shouldn't be an issue when writing a managed wrapper using C++/CLI?

share|improve this question
It makes the function usable from a C program. And from a managed program through [DllImport] so you don't have to write a C++/CLI wrapper. –  Hans Passant Dec 30 '11 at 19:30
add comment

1 Answer

up vote 1 down vote accepted

Using extern "C" in a function declaration specifies C linkage for the function (i.e. no name mangling); see here: what does extern "C" in C++ source? . It should not adversely affect a C++/CLI caller.

share|improve this answer
add comment

Your Answer


