-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
For example, in Windows, a proper library explicitly specifies the calling convention for each function:
void __cdecl mongo::connect(char* host)
We are using the default calling convention right now, which is __cdecl. If someone is using __stdcall in their project, they won't be able to use the C++ driver because the calling convention is wrong. Actually, they will be able to compile just fine but run time will not work (and it might not even be obvious what is wrong at first).
Typically, the __cdecl is hidden inside a macro; we could use MONGO_API:
#ifdef WIN32
#define MONGO_API __cdecl
#else
#define MONGO_API
#endif
If we decide to release a DLL or .so library in the future, we could also use the MONGO_API macro to affect the visibility of the API functions using dllexport or gcc attributes.
- duplicates
-
CXX-112 Provide a SConstruct option to specify the default windows calling convention
- Closed
- is related to
-
SERVER-11879 Using Windows mongoclient.dll, statics have duplicate storage
- Closed
- related to
-
CXX-3093 Exported v_noabi functions are missing __cdecl on Windows
- Closed
-
SERVER-3364 The C++ Driver compiled as shared library must export the API
- Closed
-
SERVER-9771 Enable support for building the C++ driver as a DLL on windows.
- Closed