title: C-DLL from C++ source
body: <p>I have a C-Wrapper for my C++ Framework. Since this should run on mac and windows I am using <strong>scons</strong>:</p>
  
  <pre><code>env = Environment()
  env.Append(CPPPATH = ['./'])
  env.Append(LIBS = 'kernel32.lib')
  env.Append(LIBPATH = 'C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib')
  
  env.SharedLibrary(target='warpLib', source='warplib.cpp')
  </code></pre>
  
  <p>Simple Versions of warplib.cpp and warplib.h look like this:</p>
  
  <p><strong>warplib.cpp</strong></p>
  
  <pre><code>#define DllExport __declspec( dllexport )
  #include "warplib.h"
  
  extern "C" {
    DllExport int foo(int a) {
      return a;
    }
  }
  </code></pre>
  
  <p><strong>warplib.h</strong></p>
  
  <pre><code>#define DllExport __declspec( dllexport )
  
  extern "C" {
    DllExport int foo(int a);
  }
  </code></pre>
  
  <p>Can anybody tell me what is wrong with that? I tried almost all the combinations possible of 'extern "C"' but it always throws me something like "error C2732: linkage specification contradicts earlier specification for '...'". </p>
  
  <p>If I skip 'extern "C"' it works but I see no .lib file and I am pretty sure I need that to really use the library.</p>