[CXX-81] On Windows, MONGO_API functions should be decorated with __cdecl. Created: 19/Apr/12 Updated: 04/May/14 Resolved: 18/Apr/14 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | legacy-0.8.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Eric Milkie | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | cxxmove, legacy-cxx, windows | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
For example, in Windows, a proper library explicitly specifies the calling convention for each function:
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:
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. |
| Comments |
| Comment by Githook User [ 22/Apr/14 ] |
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: |
| Comment by Andrew Morrow (Inactive) [ 18/Apr/14 ] |
| Comment by Githook User [ 18/Apr/14 ] |
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: |
| Comment by Andrew Morrow (Inactive) [ 18/Apr/14 ] |
| Comment by Andy Schwerin [ 10/Dec/13 ] |
|
__cdecl declaration, to be complete, would probably involve annotating every member function in every class, and can only matter on 32-bit Windows in practice. Deferring. |
| Comment by Githook User [ 10/Dec/13 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}Message: |
| Comment by Githook User [ 09/Dec/13 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}Message: Also addresses |
| Comment by Githook User [ 09/Dec/13 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}Message: Also MONGO_COMPILER_API_EXPORT Puts the "export visibility" declaration on a type, MONGO_COMPILER_API_IMPORT Puts the "import from library" declaration on a type, MONGO_COMPILER_API_CALLING_CONVENTION Labels a function declaration with its |
| Comment by Githook User [ 05/Dec/13 ] |
|
Author: {u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}Message: This deduplicates documentation, hopefully preventing the documentation from diverging. |