I have following declaration:
DLL EntityHandle scenemanager_create_entity
(SceneManagerHandle handle,
const char* name,
const char* mesh_name,
const char* group_name = 0);
where last agrument has default value group_name = 0
.
When I compile C++ DLL (/TP) it works fine and while compiling a macro DLL is following:
#define DLL extern "C" __declspec(dllexport)
But when I try to compile C application (/TC) linked with this DLL it gives error C2143: syntax error : missing ')' before '=' and macro DLL is following:
#define DLL __declspec(dllimport)
There are no default arguments in C.
You could use macro __cplusplus
that to check whether the code is compiled by the C++ compiler or C compiler.
For example
#ifdef __cplusplus
// C++ function declaration...
#else
// C function declaration...
#endif
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.