diff -urN mongodb-src-r1.8.2.orig/bson/bsonelement.h mongodb-src-r1.8.2/bson/bsonelement.h --- mongodb-src-r1.8.2.orig/bson/bsonelement.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/bson/bsonelement.h 2011-07-01 17:11:46.000000000 +0300 @@ -63,7 +63,7 @@ long long Long() const { return chk(NumberLong)._numberLong(); } int Int() const { return chk(NumberInt)._numberInt(); } bool Bool() const { return chk(mongo::Bool).boolean(); } - vector Array() const; // see implementation for detailed comments + MONGO_API vector Array() const; // see implementation for detailed comments mongo::OID OID() const { return chk(jstOID).__oid(); } void Null() const { chk(isNull()); } // throw UserException if not null void OK() const { chk(ok()); } // throw UserException if element DNE @@ -74,7 +74,7 @@ returned BSONObj if you need your own copy. throws UserException if the element is not of type object. */ - BSONObj Obj() const; + MONGO_API BSONObj Obj() const; /** populate v with the value of the element. If type does not match, throw exception. useful in templates -- see also BSONObj::Vals(). @@ -82,7 +82,7 @@ void Val(Date_t& v) const { v = Date(); } void Val(long long& v) const { v = Long(); } void Val(bool& v) const { v = Bool(); } - void Val(BSONObj& v) const; + MONGO_API void Val(BSONObj& v) const; void Val(mongo::OID& v) const { v = OID(); } void Val(int& v) const { v = Int(); } void Val(double& v) const { v = Double(); } @@ -93,9 +93,9 @@ */ bool ok() const { return !eoo(); } - string toString( bool includeFieldName = true, bool full=false) const; - void toString(StringBuilder& s, bool includeFieldName = true, bool full=false) const; - string jsonString( JsonStringFormat format, bool includeFieldNames = true, int pretty = 0 ) const; + MONGO_API string toString( bool includeFieldName = true, bool full=false) const; + MONGO_API void toString(StringBuilder& s, bool includeFieldName = true, bool full=false) const; + MONGO_API string jsonString( JsonStringFormat format, bool includeFieldNames = true, int pretty = 0 ) const; operator string() const { return toString(); } /** Returns the type of the element */ @@ -104,13 +104,13 @@ /** retrieve a field within this element throws exception if *this is not an embedded object */ - BSONElement operator[] (const string& field) const; + MONGO_API BSONElement operator[] (const string& field) const; /** returns the tyoe of the element fixed for the main type the main purpose is numbers. any numeric type will return NumberDouble Note: if the order changes, indexes have to be re-built or than can be corruption */ - int canonicalType() const; + MONGO_API int canonicalType() const; /** Indicates if it is the end-of-object element, which is present at the end of every BSON object. @@ -120,13 +120,13 @@ /** Size of the element. @param maxLen If maxLen is specified, don't scan more than maxLen bytes to calculate size. */ - int size( int maxLen = -1 ) const; + MONGO_API int size( int maxLen = -1 ) const; /** Wrap this element up as a singleton object. */ - BSONObj wrap() const; + MONGO_API BSONObj wrap() const; /** Wrap this element up as a singleton object with a new name. */ - BSONObj wrap( const char* newName) const; + MONGO_API BSONObj wrap( const char* newName) const; /** field name of the element. e.g., for name : "Joe" @@ -165,13 +165,13 @@ /** Convert the value to boolean, regardless of its type, in a javascript-like fashion (i.e., treat zero and null as false). */ - bool trueValue() const; + MONGO_API bool trueValue() const; /** True if number, string, bool, date, OID */ - bool isSimpleType() const; + MONGO_API bool isSimpleType() const; /** True if element is of a numeric type. */ - bool isNumber() const; + MONGO_API bool isNumber() const; /** Return double value for this field. MUST be NumberDouble type. */ double _numberDouble() const {return *reinterpret_cast< const double* >( value() ); } @@ -181,13 +181,13 @@ long long _numberLong() const {return *reinterpret_cast< const long long* >( value() ); } /** Retrieve int value for the element safely. Zero returned if not a number. */ - int numberInt() const; + MONGO_API int numberInt() const; /** Retrieve long value for the element safely. Zero returned if not a number. */ - long long numberLong() const; + MONGO_API long long numberLong() const; /** Retrieve the numeric value of the element. If not of a numeric type, returns 0. Note: casts to double, data loss may occur with large (>52 bit) NumberLong values. */ - double numberDouble() const; + MONGO_API double numberDouble() const; /** Retrieve the numeric value of the element. If not of a numeric type, returns 0. Note: casts to double, data loss may occur with large (>52 bit) NumberLong values. */ @@ -240,12 +240,12 @@ } /** Get the embedded object this element holds. */ - BSONObj embeddedObject() const; + MONGO_API BSONObj embeddedObject() const; /* uasserts if not an object */ - BSONObj embeddedObjectUserCheck() const; + MONGO_API BSONObj embeddedObjectUserCheck() const; - BSONObj codeWScopeObject() const; + MONGO_API BSONObj codeWScopeObject() const; /** Get raw binary data. Element must be of type BinData. Doesn't handle type 2 specially */ const char *binData(int& len) const { @@ -303,18 +303,18 @@ order by type, field name, and field value. If considerFieldName is true, pay attention to the field name. */ - int woCompare( const BSONElement &e, bool considerFieldName = true ) const; + MONGO_API int woCompare( const BSONElement &e, bool considerFieldName = true ) const; const char * rawdata() const { return data; } /** 0 == Equality, just not defined yet */ - int getGtLtOp( int def = 0 ) const; + MONGO_API int getGtLtOp( int def = 0 ) const; /** Constructs an empty element */ - BSONElement(); + MONGO_API BSONElement(); /** Check that data is internally consistent. */ - void validate() const; + MONGO_API void validate() const; /** True if this element may contain subobjects. */ bool mayEncapsulate() const { @@ -381,8 +381,8 @@ totalSize = -1; } - string _asCode() const; - OpTime _opTime() const; + MONGO_API string _asCode() const; + MONGO_API OpTime _opTime() const; private: const char *data; diff -urN mongodb-src-r1.8.2.orig/bson/bsonmisc.h mongodb-src-r1.8.2/bson/bsonmisc.h --- mongodb-src-r1.8.2.orig/bson/bsonmisc.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/bson/bsonmisc.h 2011-07-01 17:24:20.000000000 +0300 @@ -80,20 +80,20 @@ Example: cout << BSON( GENOID << "z" << 3 ); // { _id : ..., z : 3 } */ - extern struct GENOIDLabeler { } GENOID; + extern MONGO_API struct GENOIDLabeler { } GENOID; /* Utility class to add a Date element with the current time Example: cout << BSON( "created" << DATENOW ); // { created : "2009-10-09 11:41:42" } */ - extern struct DateNowLabeler { } DATENOW; + extern MONGO_API struct DateNowLabeler { } DATENOW; /* Utility class to add the minKey (minus infinity) to a given attribute Example: cout << BSON( "a" << MINKEY ); // { "a" : { "$minKey" : 1 } } */ - extern struct MinKeyLabeler { } MINKEY; - extern struct MaxKeyLabeler { } MAXKEY; + extern MONGO_API struct MinKeyLabeler { } MINKEY; + extern MONGO_API struct MaxKeyLabeler { } MAXKEY; // Utility class to implement GT, GTE, etc as described above. class Labeler { @@ -111,48 +111,48 @@ one gets { age : { $gt : someElement's value } } */ - BSONObjBuilder& operator<<( const BSONElement& e ); + MONGO_API BSONObjBuilder& operator<<( const BSONElement& e ); private: const Label &l_; BSONObjBuilderValueStream *s_; }; - extern Labeler::Label GT; - extern Labeler::Label GTE; - extern Labeler::Label LT; - extern Labeler::Label LTE; - extern Labeler::Label NE; - extern Labeler::Label SIZE; + extern MONGO_API Labeler::Label GT; + extern MONGO_API Labeler::Label GTE; + extern MONGO_API Labeler::Label LT; + extern MONGO_API Labeler::Label LTE; + extern MONGO_API Labeler::Label NE; + extern MONGO_API Labeler::Label SIZE; // $or helper: OR(BSON("x" << GT << 7), BSON("y" << LT << 6)); // becomes : {$or: [{x: {$gt: 7}}, {y: {$lt: 6}}]} - inline BSONObj OR(const BSONObj& a, const BSONObj& b); - inline BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c); - inline BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c, const BSONObj& d); - inline BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c, const BSONObj& d, const BSONObj& e); - inline BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c, const BSONObj& d, const BSONObj& e, const BSONObj& f); + inline MONGO_API BSONObj OR(const BSONObj& a, const BSONObj& b); + inline MONGO_API BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c); + inline MONGO_API BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c, const BSONObj& d); + inline MONGO_API BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c, const BSONObj& d, const BSONObj& e); + inline MONGO_API BSONObj OR(const BSONObj& a, const BSONObj& b, const BSONObj& c, const BSONObj& d, const BSONObj& e, const BSONObj& f); // definitions in bsonobjbuilder.h b/c of incomplete types // Utility class to implement BSON( key << val ) as described above. class BSONObjBuilderValueStream : public boost::noncopyable { public: friend class Labeler; - BSONObjBuilderValueStream( BSONObjBuilder * builder ); + MONGO_API BSONObjBuilderValueStream( BSONObjBuilder * builder ); - BSONObjBuilder& operator<<( const BSONElement& e ); + MONGO_API BSONObjBuilder& operator<<( const BSONElement& e ); template BSONObjBuilder& operator<<( T value ); - BSONObjBuilder& operator<<(DateNowLabeler& id); + MONGO_API BSONObjBuilder& operator<<(DateNowLabeler& id); - BSONObjBuilder& operator<<(MinKeyLabeler& id); - BSONObjBuilder& operator<<(MaxKeyLabeler& id); + MONGO_API BSONObjBuilder& operator<<(MinKeyLabeler& id); + MONGO_API BSONObjBuilder& operator<<(MaxKeyLabeler& id); - Labeler operator<<( const Labeler::Label &l ); + MONGO_API Labeler operator<<( const Labeler::Label &l ); - void endField( const char *nextFieldName = 0 ); + MONGO_API void endField( const char *nextFieldName = 0 ); bool subobjStarted() const { return _fieldName != 0; } private: @@ -165,7 +165,7 @@ }; /** - used in conjuction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory usage + used in conjunction with BSONObjBuilder, allows for proper buffer size to prevent crazy memory usage */ class BSONSizeTracker { public: diff -urN mongodb-src-r1.8.2.orig/bson/bsonobjbuilder.h mongodb-src-r1.8.2/bson/bsonobjbuilder.h --- mongodb-src-r1.8.2.orig/bson/bsonobjbuilder.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/bson/bsonobjbuilder.h 2011-07-01 17:38:48.000000000 +0300 @@ -102,10 +102,10 @@ } /** add all the fields from the object specified to this object */ - BSONObjBuilder& appendElements(BSONObj x); + MONGO_API BSONObjBuilder& appendElements(BSONObj x); /** add all the fields from the object specified to this object if they don't exist already */ - BSONObjBuilder& appendElementsUnique( BSONObj x ); + MONGO_API BSONObjBuilder& appendElementsUnique( BSONObj x ); /** append element to the object we are building */ BSONObjBuilder& append( const BSONElement& e) { @@ -272,7 +272,7 @@ /** tries to append the data as a number * @return true if the data was able to be converted to a number */ - bool appendAsNumber( const StringData& fieldName , const string& data ); + MONGO_API bool appendAsNumber( const StringData& fieldName , const string& data ); /** Append a BSON Object ID (OID type). @deprecated Generally, it is preferred to use the append append(name, oid) @@ -431,7 +431,7 @@ Append a timestamp element to the object being ebuilt. @param time - in millis (but stored in seconds) */ - BSONObjBuilder& appendTimestamp( const StringData& fieldName , unsigned long long time , unsigned int inc ); + MONGO_API BSONObjBuilder& appendTimestamp( const StringData& fieldName , unsigned long long time , unsigned int inc ); /* Append an element of the deprecated DBRef type. @@ -507,8 +507,8 @@ /** these are the min/max when comparing, not strict min/max elements for a given type */ - void appendMinForType( const StringData& fieldName , int type ); - void appendMaxForType( const StringData& fieldName , int type ); + MONGO_API void appendMinForType( const StringData& fieldName , int type ); + MONGO_API void appendMaxForType( const StringData& fieldName , int type ); /** Append an array of values. */ template < class T > @@ -566,7 +566,7 @@ _b.decouple(); // post done() call version. be sure jsobj frees... } - void appendKeys( const BSONObj& keyPattern , const BSONObj& values ); + MONGO_API void appendKeys( const BSONObj& keyPattern , const BSONObj& values ); static string numStr( int i ) { if (i>=0 && i<100) @@ -617,9 +617,9 @@ /** @return true if we are using our own bufbuilder, and not an alternate that was given to us in our constructor */ bool owned() const { return &_b == &_buf; } - BSONObjIterator iterator() const ; + MONGO_API BSONObjIterator iterator() const ; - bool hasField( const StringData& name ) const ; + MONGO_API bool hasField( const StringData& name ) const ; int len() const { return _b.len(); } @@ -646,7 +646,7 @@ BSONSizeTracker * _tracker; bool _doneCalled; - static const string numStrs[100]; // cache of 0 to 99 inclusive + MONGO_API static const string numStrs[100]; // cache of 0 to 99 inclusive }; class BSONArrayBuilder : boost::noncopyable { @@ -724,12 +724,12 @@ append( nullElt() ); } - static BSONElement nullElt() { + MONGO_API static BSONElement nullElt() { static BSONObj n = nullObj(); return n.firstElement(); } - static BSONObj nullObj() { + MONGO_API static BSONObj nullObj() { BSONObjBuilder _b; _b.appendNull( "" ); return _b.obj(); diff -urN mongodb-src-r1.8.2.orig/bson/bsonobj.h mongodb-src-r1.8.2/bson/bsonobj.h --- mongodb-src-r1.8.2.orig/bson/bsonobj.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/bson/bsonobj.h 2011-07-01 17:33:18.000000000 +0300 @@ -76,10 +76,10 @@ init(msgdata, ifree); } - explicit BSONObj(const Record *r); + explicit MONGO_API BSONObj(const Record *r); /** Construct an empty BSONObj -- that is, {}. */ - BSONObj(); + MONGO_API BSONObj(); ~BSONObj() { /*defensive:*/ _objdata = 0; } @@ -114,37 +114,37 @@ bool isOwned() const { return _holder.get() != 0; } /* make sure the data buffer is under the control of this BSONObj and not a remote buffer */ - BSONObj getOwned() const; + MONGO_API BSONObj getOwned() const; /** @return a new full (and owned) copy of the object. */ - BSONObj copy() const; + MONGO_API BSONObj copy() const; /** Readable representation of a BSON object in an extended JSON-style notation. This is an abbreviated representation which might be used for logging. */ - string toString( bool isArray = false, bool full=false ) const; - void toString(StringBuilder& s, bool isArray = false, bool full=false ) const; + MONGO_API string toString( bool isArray = false, bool full=false ) const; + MONGO_API void toString(StringBuilder& s, bool isArray = false, bool full=false ) const; /** Properly formatted JSON string. @param pretty if true we try to add some lf's and indentation */ - string jsonString( JsonStringFormat format = Strict, int pretty = 0 ) const; + MONGO_API string jsonString( JsonStringFormat format = Strict, int pretty = 0 ) const; /** note: addFields always adds _id even if not specified */ - int addFields(BSONObj& from, set& fields); /* returns n added */ + MONGO_API int addFields(BSONObj& from, set& fields); /* returns n added */ /** returns # of top level fields in the object note: iterates to count the fields */ - int nFields() const; + MONGO_API int nFields() const; /** adds the field names to the fields set. does NOT clear it (appends). */ - int getFieldNames(set& fields) const; + MONGO_API int getFieldNames(set& fields) const; /** return has eoo() true if no match supports "." notation to reach into embedded objects */ - BSONElement getFieldDotted(const char *name) const; + MONGO_API BSONElement getFieldDotted(const char *name) const; /** return has eoo() true if no match supports "." notation to reach into embedded objects */ @@ -154,16 +154,16 @@ /** Like getFieldDotted(), but expands multikey arrays and returns all matching objects */ - void getFieldsDotted(const StringData& name, BSONElementSet &ret ) const; + MONGO_API void getFieldsDotted(const StringData& name, BSONElementSet &ret ) const; /** Like getFieldDotted(), but returns first array encountered while traversing the dotted fields of name. The name variable is updated to represent field names with respect to the returned element. */ - BSONElement getFieldDottedOrArray(const char *&name) const; + MONGO_API BSONElement getFieldDottedOrArray(const char *&name) const; /** Get the field of the specified name. eoo() is true on the returned element if not found. */ - BSONElement getField(const StringData& name) const; + MONGO_API BSONElement getField(const StringData& name) const; /** Get the field of the specified name. eoo() is true on the returned element if not found. @@ -187,34 +187,34 @@ bool hasField( const char * name ) const { return ! getField( name ).eoo(); } /** @return "" if DNE or wrong type */ - const char * getStringField(const char *name) const; + MONGO_API const char * getStringField(const char *name) const; /** @return subobject of the given name */ - BSONObj getObjectField(const char *name) const; + MONGO_API BSONObj getObjectField(const char *name) const; /** @return INT_MIN if not present - does some type conversions */ - int getIntField(const char *name) const; + MONGO_API int getIntField(const char *name) const; /** @return false if not present */ - bool getBoolField(const char *name) const; + MONGO_API bool getBoolField(const char *name) const; /** sets element field names to empty string If a field in pattern is missing, it is omitted from the returned object. */ - BSONObj extractFieldsUnDotted(BSONObj pattern) const; + MONGO_API BSONObj extractFieldsUnDotted(BSONObj pattern) const; /** extract items from object which match a pattern object. e.g., if pattern is { x : 1, y : 1 }, builds an object with x and y elements of this object, if they are present. returns elements with original field names */ - BSONObj extractFields(const BSONObj &pattern , bool fillWithNull=false) const; + MONGO_API BSONObj extractFields(const BSONObj &pattern , bool fillWithNull=false) const; - BSONObj filterFieldsUndotted(const BSONObj &filter, bool inFilter) const; + MONGO_API BSONObj filterFieldsUndotted(const BSONObj &filter, bool inFilter) const; - BSONElement getFieldUsingIndexNames(const char *fieldName, const BSONObj &indexKey) const; + MONGO_API BSONElement getFieldUsingIndexNames(const char *fieldName, const BSONObj &indexKey) const; /** @return the raw data of the object */ const char *objdata() const { @@ -224,27 +224,27 @@ int objsize() const { return *(reinterpret_cast(objdata())); } /** performs a cursory check on the object's size only. */ - bool isValid(); + MONGO_API bool isValid(); /** @return if the user is a valid user doc criter: isValid() no . or $ field names */ - bool okForStorage() const; + MONGO_API bool okForStorage() const; /** @return true if object is empty -- i.e., {} */ bool isEmpty() const { return objsize() <= 5; } - void dump() const; + MONGO_API void dump() const; /** Alternative output format */ - string hexDump() const; + MONGO_API string hexDump() const; /**wo='well ordered'. fields must be in same order in each object. Ordering is with respect to the signs of the elements and allows ascending / descending key mixing. @return <0 if l0 if l>r */ - int woCompare(const BSONObj& r, const Ordering &o, + MONGO_API int woCompare(const BSONObj& r, const Ordering &o, bool considerFieldName=true) const; /**wo='well ordered'. fields must be in same order in each object. @@ -252,7 +252,7 @@ and allows ascending / descending key mixing. @return <0 if l0 if l>r */ - int woCompare(const BSONObj& r, const BSONObj &ordering = BSONObj(), + MONGO_API int woCompare(const BSONObj& r, const BSONObj &ordering = BSONObj(), bool considerFieldName=true) const; @@ -264,7 +264,7 @@ /** * @param useDotted whether to treat sort key fields as possibly dotted and expand into them */ - int woSortOrder( const BSONObj& r , const BSONObj& sortKey , bool useDotted=false ) const; + MONGO_API int woSortOrder( const BSONObj& r , const BSONObj& sortKey , bool useDotted=false ) const; /** This is "shallow equality" -- ints and doubles won't match. for a deep equality test use woCompare (which is slower). @@ -281,14 +281,14 @@ BSONElement firstElement() const { return BSONElement(objdata() + 4); } /** @return true if field exists in the object */ - bool hasElement(const char *name) const; + MONGO_API bool hasElement(const char *name) const; /** Get the _id field from the object. For good performance drivers should assure that _id is the first element of the object; however, correct operation is assured regardless. @return true if found */ - bool getObjectID(BSONElement& e) const; + MONGO_API bool getObjectID(BSONElement& e) const; /** @return A hash code for the object */ int hash() const { @@ -303,17 +303,17 @@ // that are not part of the bson wire protocol are replaced with // string identifier equivalents. // TODO Support conversion of element types other than min and max. - BSONObj clientReadable() const; + MONGO_API BSONObj clientReadable() const; /** Return new object with the field names replaced by those in the passed object. */ - BSONObj replaceFieldNames( const BSONObj &obj ) const; + MONGO_API BSONObj replaceFieldNames( const BSONObj &obj ) const; /** true unless corrupt */ - bool valid() const; + MONGO_API bool valid() const; /** @return an md5 value for this object. */ - string md5() const; + MONGO_API string md5() const; bool operator==( const BSONObj& other ) const { return woCompare( other ) == 0; @@ -342,9 +342,9 @@ }; /** add all elements of the object to the specified vector */ - void elems(vector &) const; + MONGO_API void elems(vector &) const; /** add all elements of the object to the specified list */ - void elems(list &) const; + MONGO_API void elems(list &) const; /** add all values of the object to the specified vector. If type mismatches, exception. this is most useful when the BSONObj is an array, but can be used with non-arrays too in theory. @@ -376,7 +376,7 @@ ... } */ - BSONObjIterator begin(); + MONGO_API BSONObjIterator begin(); void appendSelfToBufBuilder(BufBuilder& b) const { assert( objsize() ); @@ -410,11 +410,11 @@ } }; - ostream& operator<<( ostream &s, const BSONObj &o ); - ostream& operator<<( ostream &s, const BSONElement &e ); + MONGO_API ostream& operator<<( ostream &s, const BSONObj &o ); + MONGO_API ostream& operator<<( ostream &s, const BSONElement &e ); - StringBuilder& operator<<( StringBuilder &s, const BSONObj &o ); - StringBuilder& operator<<( StringBuilder &s, const BSONElement &e ); + MONGO_API StringBuilder& operator<<( StringBuilder &s, const BSONObj &o ); + MONGO_API StringBuilder& operator<<( StringBuilder &s, const BSONElement &e ); struct BSONArray : BSONObj { diff -urN mongodb-src-r1.8.2.orig/bson/util/builder.h mongodb-src-r1.8.2/bson/util/builder.h --- mongodb-src-r1.8.2.orig/bson/util/builder.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/bson/util/builder.h 2011-07-04 09:54:10.000000000 +0300 @@ -47,7 +47,7 @@ class StringBuilder; - void msgasserted(int msgid, const char *msg); + MONGO_API void msgasserted(int msgid, const char *msg); class BufBuilder { public: diff -urN mongodb-src-r1.8.2.orig/client/dbclientcursor.h mongodb-src-r1.8.2/client/dbclientcursor.h --- mongodb-src-r1.8.2.orig/client/dbclientcursor.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/client/dbclientcursor.h 2011-07-01 17:43:24.000000000 +0300 @@ -45,7 +45,7 @@ class DBClientCursor : public DBClientCursorInterface { public: /** If true, safe to call next(). Requests more from server if necessary. */ - bool more(); + MONGO_API bool more(); /** If true, there is more in our local buffers to be fetched via next(). Returns false when a getMore request back to server would be required. You can use this @@ -61,7 +61,7 @@ { $err: } if you do not want to handle that yourself, call nextSafe(). */ - BSONObj next(); + MONGO_API BSONObj next(); /** restore an object previously returned by next() to the cursor @@ -85,7 +85,7 @@ with what is already buffered. WARNING: no support for _putBack yet! */ - void peek(vector&, int atMost); + MONGO_API void peek(vector&, int atMost); /** iterate the rest of the cursor and return the number if items @@ -154,7 +154,7 @@ _ownCursor( true ) { } - virtual ~DBClientCursor(); + MONGO_API virtual ~DBClientCursor(); long long getCursorId() const { return cursorId; } @@ -163,7 +163,7 @@ */ void decouple() { _ownCursor = false; } - void attach( AScopedConnection * conn ); + MONGO_API void attach( AScopedConnection * conn ); private: friend class DBClientBase; diff -urN mongodb-src-r1.8.2.orig/client/dbclient.h mongodb-src-r1.8.2/client/dbclient.h --- mongodb-src-r1.8.2.orig/client/dbclient.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/client/dbclient.h 2011-07-04 11:00:46.000000000 +0300 @@ -174,7 +174,7 @@ string toString() const { return _string; } - DBClientBase* connect( string& errmsg ) const; + MONGO_API DBClientBase* connect( string& errmsg ) const; string getSetName() const { return _setName; } @@ -182,9 +182,9 @@ ConnectionType type() const { return _type; } - static ConnectionString parse( const string& url , string& errmsg ); + MONGO_API static ConnectionString parse( const string& url , string& errmsg ); - static string typeToString( ConnectionType type ); + MONGO_API static string typeToString( ConnectionType type ); private: @@ -235,7 +235,7 @@ or fromjson(" name : 1, ts : -1 ") */ - Query& sort(const BSONObj& sortPattern); + MONGO_API Query& sort(const BSONObj& sortPattern); /** Add a sort (ORDER BY) criteria to the query expression. This version of sort() assumes you want to sort on a single field. @@ -249,22 +249,22 @@ Example: hint("{ts:1}") */ - Query& hint(BSONObj keyPattern); + MONGO_API Query& hint(BSONObj keyPattern); Query& hint(const string &jsonKeyPatt) { return hint(fromjson(jsonKeyPatt)); } /** Provide min and/or max index limits for the query. min <= x < max */ - Query& minKey(const BSONObj &val); + MONGO_API Query& minKey(const BSONObj &val); /** max is exclusive */ - Query& maxKey(const BSONObj &val); + MONGO_API Query& maxKey(const BSONObj &val); /** Return explain information about execution of this query instead of the actual query results. Normally it is easier to use the mongo shell to run db.find(...).explain(). */ - Query& explain(); + MONGO_API Query& explain(); /** Use snapshot mode for the query. Snapshot mode assures no duplicates are returned, or objects missed, which were present at both the start and end of the query's execution (if an object is new during the query, or deleted during @@ -274,7 +274,7 @@ Currently, snapshot mode may not be used with sorting or explicit hints. */ - Query& snapshot(); + MONGO_API Query& snapshot(); /** Queries to the Mongo database support a $where parameter option which contains a javascript function that is evaluated to see whether objects being queried match @@ -292,20 +292,20 @@ conn.findOne("test.coll", Query("{a:3}").where("this.b == 2 || this.c == 3")); Query badBalance = Query().where("this.debits - this.credits < 0"); */ - Query& where(const string &jscode, BSONObj scope); + MONGO_API Query& where(const string &jscode, BSONObj scope); Query& where(const string &jscode) { return where(jscode, BSONObj()); } /** * if this query has an orderby, hint, or some other field */ - bool isComplex( bool * hasDollar = 0 ) const; + MONGO_API bool isComplex( bool * hasDollar = 0 ) const; - BSONObj getFilter() const; - BSONObj getSort() const; - BSONObj getHint() const; - bool isExplain() const; + MONGO_API BSONObj getFilter() const; + MONGO_API BSONObj getSort() const; + MONGO_API BSONObj getHint() const; + MONGO_API bool isExplain() const; - string toString() const; + MONGO_API string toString() const; operator string() const { return toString(); } private: void makeComplex(); @@ -365,7 +365,7 @@ @return a single object that matches the query. if none do, then the object is empty @throws AssertionException */ - virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); + MONGO_API virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); virtual string getServerAddress() const = 0; @@ -389,7 +389,7 @@ @param command -- command name @return true if the command returned "ok". */ - bool simpleCommand(const string &dbname, BSONObj *info, const string &command); + MONGO_API bool simpleCommand(const string &dbname, BSONObj *info, const string &command); /** Run a database command. Database commands are represented as BSON objects. Common database commands have prebuilt helper functions -- see below. If a helper is not available you can @@ -402,7 +402,7 @@ @param options see enum QueryOptions - normally not needed to run a command @return true if the command returned "ok". */ - virtual bool runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info, int options=0); + MONGO_API virtual bool runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info, int options=0); /** Authorize access to a particular database. Authentication is separate for each database on the server -- you may authenticate for any @@ -412,14 +412,14 @@ @param digestPassword if password is plain text, set this to true. otherwise assumed to be pre-digested @return true if successful */ - virtual bool auth(const string &dbname, const string &username, const string &pwd, string& errmsg, bool digestPassword = true); + MONGO_API virtual bool auth(const string &dbname, const string &username, const string &pwd, string& errmsg, bool digestPassword = true); /** count number of objects in collection ns that match the query criteria specified throws UserAssertion if database returns an error */ - virtual unsigned long long count(const string &ns, const BSONObj& query = BSONObj(), int options=0, int limit=0, int skip=0 ); + MONGO_API virtual unsigned long long count(const string &ns, const BSONObj& query = BSONObj(), int options=0, int limit=0, int skip=0 ); - string createPasswordDigest( const string &username , const string &clearTextPassword ); + MONGO_API string createPasswordDigest( const string &username , const string &clearTextPassword ); /** returns true in isMaster parm if this db is the current master of a replica pair. @@ -429,7 +429,7 @@ returns true if command invoked successfully. */ - virtual bool isMaster(bool& isMaster, BSONObj *info=0); + MONGO_API virtual bool isMaster(bool& isMaster, BSONObj *info=0); /** Create a new collection in the database. Normally, collection creation is automatic. You would @@ -447,18 +447,18 @@ returns true if successful. */ - bool createCollection(const string &ns, long long size = 0, bool capped = false, int max = 0, BSONObj *info = 0); + MONGO_API bool createCollection(const string &ns, long long size = 0, bool capped = false, int max = 0, BSONObj *info = 0); /** Get error result from the last operation on this connection. @return error message text, or empty string if no error. */ - string getLastError(); + MONGO_API string getLastError(); /** Get error result from the last operation on this connection. @return full error object. */ - virtual BSONObj getLastErrorDetailed(); + MONGO_API virtual BSONObj getLastErrorDetailed(); - static string getLastErrorString( const BSONObj& res ); + MONGO_API static string getLastErrorString( const BSONObj& res ); /** Return the last error which has occurred, even if not the very last operation. @@ -466,7 +466,7 @@ result.err will be null if no error has occurred. */ - BSONObj getPrevError(); + MONGO_API BSONObj getPrevError(); /** Reset the previous error state for this connection (accessed via getLastError and getPrevError). Useful when performing several operations at once and then checking @@ -513,7 +513,7 @@ returns true if successful */ - bool copyDatabase(const string &fromdb, const string &todb, const string &fromhost = "", BSONObj *info = 0); + MONGO_API bool copyDatabase(const string &fromdb, const string &todb, const string &fromhost = "", BSONObj *info = 0); /** The Mongo database provides built-in performance profiling capabilities. Uset setDbProfilingLevel() to enable. Profiling information is then written to the system.profiling collection, which one can @@ -525,8 +525,8 @@ ProfileAll = 2 }; - bool setDbProfilingLevel(const string &dbname, ProfilingLevel level, BSONObj *info = 0); - bool getDbProfilingLevel(const string &dbname, ProfilingLevel& level, BSONObj *info = 0); + MONGO_API bool setDbProfilingLevel(const string &dbname, ProfilingLevel level, BSONObj *info = 0); + MONGO_API bool getDbProfilingLevel(const string &dbname, ProfilingLevel& level, BSONObj *info = 0); /** This implicitly converts from char*, string, and BSONObj to be an argument to mapreduce @@ -539,7 +539,7 @@ BSONObj out; }; - static MROutput MRInline; + MONGO_API static MROutput MRInline; /** Run a map/reduce job on the server. @@ -564,7 +564,7 @@ result.getField("ok").trueValue() on the result to check if ok. */ - BSONObj mapreduce(const string &ns, const string &jsmapf, const string &jsreducef, BSONObj query = BSONObj(), MROutput output = MRInline); + MONGO_API BSONObj mapreduce(const string &ns, const string &jsmapf, const string &jsreducef, BSONObj query = BSONObj(), MROutput output = MRInline); /** Run javascript code on the database server. dbname database SavedContext in which the code runs. The javascript variable 'db' will be assigned @@ -581,7 +581,7 @@ See testDbEval() in dbclient.cpp for an example of usage. */ - bool eval(const string &dbname, const string &jscode, BSONObj& info, BSONElement& retValue, BSONObj *args = 0); + MONGO_API bool eval(const string &dbname, const string &jscode, BSONObj& info, BSONElement& retValue, BSONObj *args = 0); /** validate a collection, checking for errors and reporting back statistics. this operation is slow and blocking. @@ -595,7 +595,7 @@ /* The following helpers are simply more convenient forms of eval() for certain common cases */ /* invocation with no return value of interest -- with or without one simple parameter */ - bool eval(const string &dbname, const string &jscode); + MONGO_API bool eval(const string &dbname, const string &jscode); template< class T > bool eval(const string &dbname, const string &jscode, T parm1) { BSONObj info; @@ -625,14 +625,14 @@ uses the { listDatabases : 1 } command. throws on error */ - list getDatabaseNames(); + MONGO_API list getDatabaseNames(); /** get a list of all the current collections in db */ - list getCollectionNames( const string& db ); + MONGO_API list getCollectionNames( const string& db ); - bool exists( const string& ns ); + MONGO_API bool exists( const string& ns ); /** Create an index if it does not already exist. ensureIndex calls are remembered so it is safe/fast to call this function many @@ -645,27 +645,27 @@ @return whether or not sent message to db. should be true on first call, false on subsequent unless resetIndexCache was called */ - virtual bool ensureIndex( const string &ns , BSONObj keys , bool unique = false, const string &name = "", + MONGO_API virtual bool ensureIndex( const string &ns , BSONObj keys , bool unique = false, const string &name = "", bool cache = true ); /** clears the index cache, so the subsequent call to ensureIndex for any index will go to the server */ - virtual void resetIndexCache(); + MONGO_API virtual void resetIndexCache(); - virtual auto_ptr getIndexes( const string &ns ); + MONGO_API virtual auto_ptr getIndexes( const string &ns ); - virtual void dropIndex( const string& ns , BSONObj keys ); - virtual void dropIndex( const string& ns , const string& indexName ); + MONGO_API virtual void dropIndex( const string& ns , BSONObj keys ); + MONGO_API virtual void dropIndex( const string& ns , const string& indexName ); /** drops all indexes for the collection */ - virtual void dropIndexes( const string& ns ); + MONGO_API virtual void dropIndexes( const string& ns ); - virtual void reIndex( const string& ns ); + MONGO_API virtual void reIndex( const string& ns ); - string genIndexName( const BSONObj& keys ); + MONGO_API string genIndexName( const BSONObj& keys ); /** Erase / drop an entire database */ virtual bool dropDatabase(const string &dbname, BSONObj *info = 0) { @@ -735,7 +735,7 @@ @return cursor. 0 if error (connection failure) @throws AssertionException */ - virtual auto_ptr query(const string &ns, Query query, int nToReturn = 0, int nToSkip = 0, + MONGO_API virtual auto_ptr query(const string &ns, Query query, int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ); /** don't use this - called automatically by DBClientCursor for you @@ -743,28 +743,28 @@ @return an handle to a previously allocated cursor @throws AssertionException */ - virtual auto_ptr getMore( const string &ns, long long cursorId, int nToReturn = 0, int options = 0 ); + MONGO_API virtual auto_ptr getMore( const string &ns, long long cursorId, int nToReturn = 0, int options = 0 ); /** insert an object into the database */ - virtual void insert( const string &ns , BSONObj obj ); + MONGO_API virtual void insert( const string &ns , BSONObj obj ); /** insert a vector of objects into the database */ - virtual void insert( const string &ns, const vector< BSONObj >& v ); + MONGO_API virtual void insert( const string &ns, const vector< BSONObj >& v ); /** remove matching objects from the database @param justOne if this true, then once a single match is found will stop */ - virtual void remove( const string &ns , Query q , bool justOne = 0 ); + MONGO_API virtual void remove( const string &ns , Query q , bool justOne = 0 ); /** updates objects matching query */ - virtual void update( const string &ns , Query query , BSONObj obj , bool upsert = false , bool multi = false ); + MONGO_API virtual void update( const string &ns , Query query , BSONObj obj , bool upsert = false , bool multi = false ); virtual bool isFailed() const = 0; @@ -832,7 +832,7 @@ @param errmsg any relevant error message will appended to the string @return false if fails to connect. */ - virtual bool connect(const HostAndPort& server, string& errmsg); + MONGO_API virtual bool connect(const HostAndPort& server, string& errmsg); /** Connect to a Mongo database server. Exception throwing version. Throws a UserException if cannot connect. @@ -848,7 +848,7 @@ throw ConnectException(string("can't connect ") + errmsg); } - virtual bool auth(const string &dbname, const string &username, const string &pwd, string& errmsg, bool digestPassword = true); + MONGO_API virtual bool auth(const string &dbname, const string &username, const string &pwd, string& errmsg, bool digestPassword = true); virtual auto_ptr query(const string &ns, Query query=Query(), int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ) { @@ -862,8 +862,8 @@ Use DBClientCursorBatchIterator version if you want to do items in large blocks, perhaps to avoid granular locking and such. */ - unsigned long long query( boost::function f, const string& ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); - unsigned long long query( boost::function f, const string& ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); + MONGO_API unsigned long long query( boost::function f, const string& ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); + MONGO_API unsigned long long query( boost::function f, const string& ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); /** @return true if this connection is currently in a failed state. When autoreconnect is on, @@ -885,12 +885,12 @@ string getServerAddress() const { return _serverString; } - virtual void killCursor( long long cursorID ); + MONGO_API virtual void killCursor( long long cursorID ); virtual bool callRead( Message& toSend , Message& response ) { return call( toSend , response ); } - virtual void say( Message &toSend ); - virtual bool call( Message &toSend, Message &response, bool assertOk = true , string * actualServer = 0 ); + MONGO_API virtual void say( Message &toSend ); + MONGO_API virtual bool call( Message &toSend, Message &response, bool assertOk = true , string * actualServer = 0 ); virtual ConnectionString::ConnectionType type() const { return ConnectionString::MASTER; } - virtual void checkResponse( const char *data, int nReturned ); + MONGO_API virtual void checkResponse( const char *data, int nReturned ); void setSoTimeout(double to) { _so_timeout = to; } static int getNumConnections() { @@ -902,8 +902,8 @@ protected: friend class SyncClusterConnection; - virtual void recv( Message& m ); - virtual void sayPiggyBack( Message &toSend ); + MONGO_API virtual void recv( Message& m ); + MONGO_API virtual void sayPiggyBack( Message &toSend ); DBClientReplicaSet *clientSet; boost::scoped_ptr p; @@ -913,7 +913,7 @@ time_t lastReconnectTry; HostAndPort _server; // remember for reconnects string _serverString; - void _checkConnection(); + MONGO_API void _checkConnection(); // throws SocketException if in failed state and not reconnecting or if waiting to reconnect void checkConnection() { if( failed ) _checkConnection(); } @@ -922,15 +922,15 @@ double _so_timeout; bool _connect( string& errmsg ); - static AtomicUInt _numConnections; - static bool _lazyKillCursor; // lazy means we piggy back kill cursors on next op + MONGO_API static AtomicUInt _numConnections; + MONGO_API static bool _lazyKillCursor; // lazy means we piggy back kill cursors on next op }; /** pings server to check if it's up */ - bool serverAlive( const string &uri ); + MONGO_API bool serverAlive( const string &uri ); - DBClientBase * createDirectClient(); + MONGO_API DBClientBase * createDirectClient(); } // namespace mongo diff -urN mongodb-src-r1.8.2.orig/client/dbclient_rs.h mongodb-src-r1.8.2/client/dbclient_rs.h --- mongodb-src-r1.8.2.orig/client/dbclient_rs.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/client/dbclient_rs.h 2011-07-04 10:59:04.000000000 +0300 @@ -40,13 +40,13 @@ /** * gets a cached Monitor per name or will create if doesn't exist */ - static ReplicaSetMonitorPtr get( const string& name , const vector& servers ); + MONGO_API static ReplicaSetMonitorPtr get( const string& name , const vector& servers ); /** * checks all sets for current master and new secondaries * usually only called from a BackgroundJob */ - static void checkAll(); + MONGO_API static void checkAll(); /** * this is called whenever the config of any repclia set changes @@ -54,40 +54,40 @@ * asserts if one already exists * ownership passes to ReplicaSetMonitor and the hook will actually never be deleted */ - static void setConfigChangeHook( ConfigChangeHook hook ); + MONGO_API static void setConfigChangeHook( ConfigChangeHook hook ); - ~ReplicaSetMonitor(); + MONGO_API ~ReplicaSetMonitor(); /** @return HostAndPort or throws an exception */ - HostAndPort getMaster(); + MONGO_API HostAndPort getMaster(); /** * notify the monitor that server has faild */ - void notifyFailure( const HostAndPort& server ); + MONGO_API void notifyFailure( const HostAndPort& server ); /** @return prev if its still ok, and if not returns a random slave that is ok for reads */ - HostAndPort getSlave( const HostAndPort& prev ); + MONGO_API HostAndPort getSlave( const HostAndPort& prev ); /** @return a random slave that is ok for reads */ - HostAndPort getSlave(); + MONGO_API HostAndPort getSlave(); /** * notify the monitor that server has faild */ - void notifySlaveFailure( const HostAndPort& server ); + MONGO_API void notifySlaveFailure( const HostAndPort& server ); /** * checks for current master and new secondaries */ - void check(); + MONGO_API void check(); string getName() const { return _name; } - string getServerAddress() const; + MONGO_API string getServerAddress() const; - bool contains( const string& server ) const; + MONGO_API bool contains( const string& server ) const; private: /** @@ -168,45 +168,45 @@ public: /** Call connect() after constructing. autoReconnect is always on for DBClientReplicaSet connections. */ - DBClientReplicaSet( const string& name , const vector& servers ); - virtual ~DBClientReplicaSet(); + MONGO_API DBClientReplicaSet( const string& name , const vector& servers ); + MONGO_API virtual ~DBClientReplicaSet(); /** Returns false if nomember of the set were reachable, or neither is * master, although, * when false returned, you can still try to use this connection object, it will * try reconnects. */ - bool connect(); + MONGO_API bool connect(); /** Authorize. Authorizes all nodes as needed */ - virtual bool auth(const string &dbname, const string &username, const string &pwd, string& errmsg, bool digestPassword = true ); + MONGO_API virtual bool auth(const string &dbname, const string &username, const string &pwd, string& errmsg, bool digestPassword = true ); // ----------- simple functions -------------- /** throws userassertion "no master found" */ - virtual auto_ptr query(const string &ns, Query query, int nToReturn = 0, int nToSkip = 0, + MONGO_API virtual auto_ptr query(const string &ns, Query query, int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 , int batchSize = 0 ); /** throws userassertion "no master found" */ - virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); + MONGO_API virtual BSONObj findOne(const string &ns, const Query& query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0); - virtual void insert( const string &ns , BSONObj obj ); + MONGO_API virtual void insert( const string &ns , BSONObj obj ); /** insert multiple objects. Note that single object insert is asynchronous, so this version is only nominally faster and not worth a special effort to try to use. */ - virtual void insert( const string &ns, const vector< BSONObj >& v ); + MONGO_API virtual void insert( const string &ns, const vector< BSONObj >& v ); - virtual void remove( const string &ns , Query obj , bool justOne = 0 ); + MONGO_API virtual void remove( const string &ns , Query obj , bool justOne = 0 ); - virtual void update( const string &ns , Query query , BSONObj obj , bool upsert = 0 , bool multi = 0 ); + MONGO_API virtual void update( const string &ns , Query query , BSONObj obj , bool upsert = 0 , bool multi = 0 ); - virtual void killCursor( long long cursorID ); + MONGO_API virtual void killCursor( long long cursorID ); // ---- access raw connections ---- - DBClientConnection& masterConn(); - DBClientConnection& slaveConn(); + MONGO_API DBClientConnection& masterConn(); + MONGO_API DBClientConnection& slaveConn(); // ---- callback pieces ------- @@ -214,7 +214,7 @@ /* this is the callback from our underlying connections to notify us that we got a "not master" error. */ - void isntMaster(); + MONGO_API void isntMaster(); // ----- status ------ @@ -230,7 +230,7 @@ // ---- low level ------ - virtual bool call( Message &toSend, Message &response, bool assertOk=true , string * actualServer = 0 ); + MONGO_API virtual bool call( Message &toSend, Message &response, bool assertOk=true , string * actualServer = 0 ); virtual void say( Message &toSend ) { checkMaster()->say( toSend ); } virtual bool callRead( Message& toSend , Message& response ) { return checkMaster()->callRead( toSend , response ); } diff -urN mongodb-src-r1.8.2.orig/db/json.h mongodb-src-r1.8.2/db/json.h --- mongodb-src-r1.8.2.orig/db/json.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/db/json.h 2011-06-30 18:21:36.000000000 +0300 @@ -33,9 +33,9 @@ \throws MsgAssertionException if parsing fails. The message included with this assertion includes a rough indication of where parsing failed. */ - BSONObj fromjson(const string &str); + BSONObj MONGO_API fromjson(const string &str); /** len will be size of JSON object in text chars. */ - BSONObj fromjson(const char *str, int* len=NULL); + BSONObj MONGO_API fromjson(const char *str, int* len=NULL); } // namespace mongo diff -urN mongodb-src-r1.8.2.orig/pch.h mongodb-src-r1.8.2/pch.h --- mongodb-src-r1.8.2.orig/pch.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/pch.h 2011-06-30 16:37:46.000000000 +0300 @@ -94,6 +94,8 @@ #undef assert #define assert MONGO_assert +#include "util/mongodll.h" + namespace mongo { using namespace std; @@ -141,7 +143,7 @@ bool inShutdown(); using namespace boost::filesystem; - void asserted(const char *msg, const char *file, unsigned line); + MONGO_API void asserted(const char *msg, const char *file, unsigned line); } #define MONGO_assert(_Expression) (void)( (!!(_Expression)) || (mongo::asserted(#_Expression, __FILE__, __LINE__), 0) ) diff -urN mongodb-src-r1.8.2.orig/SConstruct mongodb-src-r1.8.2/SConstruct --- mongodb-src-r1.8.2.orig/SConstruct 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/SConstruct 2011-07-01 11:39:58.000000000 +0300 @@ -219,7 +219,7 @@ if has_option( "cpppath" ): env["CPPPATH"] = [get_option( "cpppath" )] -env.Append( CPPDEFINES=[ "_SCONS" , "MONGO_EXPOSE_MACROS" ] ) +env.Append( CPPDEFINES=[ "_SCONS" , "MONGO_EXPOSE_MACROS" , "MONGO_LIB" ] ) env.Append( CPPPATH=[ "." ] ) @@ -1118,6 +1118,8 @@ # c++ library clientLibName = str( env.Library( "mongoclient" , allClientFiles )[0] ) if has_option( "sharedclient" ): + if windows: + env.Append( CPPDEFINES="MONGO_DLL" ) sharedClientLibName = str( env.SharedLibrary( "mongoclient" , allClientFiles )[0] ) env.Library( "mongotestfiles" , commonFiles + coreDbFiles + coreServerFiles + serverOnlyFiles + ["client/gridfs.cpp"]) env.Library( "mongoshellfiles" , allClientFiles + coreServerFiles ) diff -urN mongodb-src-r1.8.2.orig/util/assert_util.h mongodb-src-r1.8.2/util/assert_util.h --- mongodb-src-r1.8.2.orig/util/assert_util.h 2011-06-15 09:43:12.000000000 +0300 +++ mongodb-src-r1.8.2/util/assert_util.h 2011-07-04 10:56:40.000000000 +0300 @@ -29,9 +29,9 @@ class AssertionCount { public: - AssertionCount(); - void rollover(); - void condrollover( int newValue ); + MONGO_API AssertionCount(); + MONGO_API void rollover(); + MONGO_API void condrollover( int newValue ); int regular; int warning; @@ -50,7 +50,7 @@ ExceptionInfo( const string& m , int c ) : msg( m ) , code( c ) { } - void append( BSONObjBuilder& b , const char * m = "$err" , const char * c = "code" ) const ; + MONGO_API void append( BSONObjBuilder& b , const char * m = "$err" , const char * c = "code" ) const ; string toString() const { stringstream ss; ss << "exception: " << code << " " << msg; return ss.str(); } bool empty() const { return msg.empty(); } @@ -118,24 +118,24 @@ }; - void asserted(const char *msg, const char *file, unsigned line); - void wasserted(const char *msg, const char *file, unsigned line); + MONGO_API void asserted(const char *msg, const char *file, unsigned line); + MONGO_API void wasserted(const char *msg, const char *file, unsigned line); /** a "user assertion". throws UserAssertion. logs. typically used for errors that a user could cause, such as dupliate key, disk full, etc. */ - void uasserted(int msgid, const char *msg); + MONGO_API void uasserted(int msgid, const char *msg); inline void uasserted(int msgid , string msg) { uasserted(msgid, msg.c_str()); } /** reported via lasterror, but don't throw exception */ - void uassert_nothrow(const char *msg); + MONGO_API void uassert_nothrow(const char *msg); /** msgassert and massert are for errors that are internal but have a well defined error text string. a stack trace is logged. */ - void msgassertedNoTrace(int msgid, const char *msg); + MONGO_API void msgassertedNoTrace(int msgid, const char *msg); inline void msgassertedNoTrace(int msgid, const string& msg) { msgassertedNoTrace( msgid , msg.c_str() ); } - void msgasserted(int msgid, const char *msg); + MONGO_API void msgasserted(int msgid, const char *msg); inline void msgasserted(int msgid, string msg) { msgasserted(msgid, msg.c_str()); } #ifdef assert @@ -179,13 +179,13 @@ enum { ASSERT_ID_DUPKEY = 11000 }; /* throws a uassertion with an appropriate msg */ - void streamNotGood( int code , string msg , std::ios& myios ); + MONGO_API void streamNotGood( int code , string msg , std::ios& myios ); inline void assertStreamGood(unsigned msgid, string msg, std::ios& myios) { if( !myios.good() ) streamNotGood(msgid, msg, myios); } - string demangleName( const type_info& typeinfo ); + MONGO_API string demangleName( const type_info& typeinfo ); } // namespace mongo diff -urN mongodb-src-r1.8.2.orig/util/mongodll.h mongodb-src-r1.8.2/util/mongodll.h --- mongodb-src-r1.8.2.orig/util/mongodll.h 1970-01-01 02:00:00.000000000 +0200 +++ mongodb-src-r1.8.2/util/mongodll.h 2011-07-04 10:29:26.000000000 +0300 @@ -0,0 +1,22 @@ +#pragma once + +#ifdef _WIN32 + #define MONGO_EXPORT __declspec(dllexport) + #define MONGO_IMPORT __declspec(dllimport) +#else + #define MONGO_EXPORT + #define MONGO_IMPORT +#endif + +// Define MONGO_EXPORTS for DLL builds +#if _WIN32 + #ifdef MONGO_DLL + #define MONGO_API MONGO_EXPORT + #elif MONGO_LIB + #define MONGO_API + #else + #define MONGO_API MONGO_IMPORT + #endif +#else + #define MONGO_API +#endif