Wrapping the C header with extern "C" {...} does not always work; as a rule, headers should be designed to work with both languages for them to work with both languages.
In this case, without any details, it’s hard to say exactly what is happening, but the inline means different things in C and C ++; I would not expect a header with inline functions to work this way. (At first, I would not expect the symptoms that you get, but they do not particularly surprise me.)
The proper way to handle this is to insist that the library provider provide a header that is designed to work in both languages.
Otherwise, the right way to handle this is to write your own C, which includes the title and wraps all the functions you need and write your own title for this C code, which is designed to be included in both languages. Which, I admit, is a lot of work; get the supplier to do their job, not do half of it for him.
James kanze
source share