Wrapping a C header
<p>I need to make a wrapper for a C header, in such a way that none of the functions from that header can be visible outside this wrapper.</p>

<p>The first thing that came to my mind was to use a namespace in the <code>include</code>, but it didn't work, as expected, due to C++ mangling, like so:</p>

<pre><code>namespace wrap {
    extern "C" {
        #include&lt;a/b/c_header.h&gt;
}};
</code></pre>

<p>This will give me errors like: <code>cannot convert 'wrap::some_type*' to 'some_type*' for argument # from __some_inner_function</code>, which I find very annoying because both types are actually the same.</p>

<p>This header has hundreds of functions which I'm currently using in my code, so wrapping one by one might not be feasible, in particular because it is not something so trivial to be solved with a few <code>sed</code>'s.</p>

<p>I'm afraid that this has no solution, and that I would simply have to accept that all functions from those headers will have global scope.</p>

<p>I wondered if I could make some fancy macros to help me on this, but I couldn't come up with anything.</p>