[SERVER-3364] The C++ Driver compiled as shared library must export the API Created: 04/Jul/11  Updated: 12/Jul/16  Resolved: 24/Jan/14

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: None
Fix Version/s: 2.5.5

Type: Improvement Priority: Major - P3
Reporter: Balint Szente Assignee: Mark Benvenuto
Resolution: Done Votes: 1
Labels: Windows, api, c++, dll, driver, export, mongoclient
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Microsoft Windows


Attachments: Text File mongodb-src-r1.8.2_dll.patch     Text File mongodb-src-r1.8.2_dll_oid_pdb.patch     File mongodb-src-r1.8.4_dll.patch    
Issue Links:
Depends
is depended on by SERVER-11879 Using Windows mongoclient.dll, static... Closed
Related
is related to CXX-81 On Windows, MONGO_API functions shoul... Closed
Participants:

 Description   

The C++ mongoclient target supports the shared library generation, however no exports are added to the generated DLL.

I took Little Max's patch and ported to 1.8.2 and modified a little bit to export only the necessary API-s: the public functions and static members. You should verify/correct whether all the necessary symbols are exported: maybe I missed some functions that we do not use in our project, but make part of the public API.

Please note that my patch assumes by default that you want to use the headers as dllimport (I think this should be the common case). For linking with the static mongoclient library the MONGO_LIB macro must be defined before including the dbclient.h (or any other header).

MCI build without Sconscript.client changes

MCI build with Sconscript.client changes



 Comments   
Comment by Githook User [ 23/Jan/14 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-3364: The C++ Driver compiled as shared library must export the API
Branch: master
https://github.com/mongodb/mongo/commit/2f1865e898437c36e39e6e153bac097fb09259a6

Comment by Githook User [ 14/Jan/14 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-3364: The C++ Driver compiled as shared library must export the API
Branch: master
https://github.com/mongodb/mongo/commit/7cb2e9607aa593bc619fc8e194920144863d0061

Comment by Githook User [ 28/Dec/13 ]

Author:

{u'username': u'ranjaykrishna', u'name': u'Ranjay Krishna', u'email': u'rak248@cornell.edu'}

Message: SERVER-3364 Label rest of client api with MONGO_CLIENT_API

build all the sharedclient programs using the new macro MONGO_CLIENT_API in mongo/client/export_macros.h

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/6c5777102a973d9b5e41619f2315b75da3be3084

Comment by Githook User [ 10/Dec/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-3364 Label enough of the client api with MONGO_CLIENT_API to build httpClientTest.
Branch: master
https://github.com/mongodb/mongo/commit/2f61f0248d0d41078d3c0b94092493361557ec29

Comment by Githook User [ 10/Dec/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-3364, SERVER-5650 Define away MONGO_CLIENT_API when not building the shared library.
Branch: master
https://github.com/mongodb/mongo/commit/82e8115bacf418f3fe8af50e04b7d6ca218d87f1

Comment by Githook User [ 09/Dec/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-3364 Introduce MONGO_CLIENT_API macro for labeling types, functions and variables.

Also addresses SERVER-5650.
Branch: master
https://github.com/mongodb/mongo/commit/1df18f9530aec174f384d5f4ff5efda8218ecd32

Comment by Githook User [ 09/Dec/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-3364 Add macros for putting visibility and calling convention declarations on declarations.

Also SERVER-5650.

MONGO_COMPILER_API_EXPORT Puts the "export visibility" declaration on a type,
function or variable.

MONGO_COMPILER_API_IMPORT Puts the "import from library" declaration on a type,
function or variable.

MONGO_COMPILER_API_CALLING_CONVENTION Labels a function declaration with its
calling convention.
Branch: master
https://github.com/mongodb/mongo/commit/3100d120989881a47b9efbaaad5aec49980301d4

Comment by Githook User [ 05/Dec/13 ]

Author:

{u'username': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-3364,SERVER-5650 Move documenation of MONGO_COMPILER macros to compiler.h.

This deduplicates documentation, hopefully preventing the documentation from diverging.
Branch: master
https://github.com/mongodb/mongo/commit/1f0b640fb7b0f6de22fe098f12d3b05b23c1caf4

Comment by Balint Szente [ 09/Nov/11 ]

Patch for r1.8.4, changes:

  1. will link dynamically with Boost to avoid TLS corruption (see issue SERVER-4234)
  2. generates PDB files, even in release
  3. embeds the manifest file into the DLL
  4. compiles also with Boost 1.44+

Usage:

  • release variant:

    scons mongoclient --sharedclient --release

  • debug variant:

    scons mongoclient --sharedclient --d

Comment by Balint Szente [ 07/Jul/11 ]

A new version of the patch, which exports also the bson/oid.h APIs and the SConscript is modified to generate PDB file in release mode too.

Generated at Thu Feb 08 03:02:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.