I have a C-Wrapper for my C++ Framework. Since this should run on mac and windows I am using scons:
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')
Simple Versions of warplib.cpp and warplib.h look like this:
warplib.cpp
#define DllExport __declspec( dllexport )
#include "warplib.h"
extern "C" {
DllExport int foo(int a) {
return a;
}
}
warplib.h
#define DllExport __declspec( dllexport )
extern "C" {
DllExport int foo(int a);
}
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 '...'".
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.