Permalink
Browse files

Fix compilation under visual studio

  • Loading branch information...
1 parent 1581a3d commit 6bf161feda588fd39a914dba03397f52ec440b68 @banker banker committed Jun 3, 2012
Showing with 17 additions and 15 deletions.
  1. +5 −4 SConstruct
  2. +5 −1 src/bson.c
  3. +3 −1 src/bson.h
  4. +2 −7 src/env_win32.c
  5. +1 −1 src/mongo.c
  6. +1 −1 src/mongo.h
View
@@ -180,10 +180,11 @@ bsonEnv = env.Clone()
if os.sys.platform == "linux2":
env.Append( SHLINKFLAGS = "-shared -Wl,-soname,libmongoc.so." + MAJOR_VERSION + "." + MINOR_VERSION )
bsonEnv.Append( SHLINKFLAGS = "-shared -Wl,-soname,libbson.so." + MAJOR_VERSION + "." + MINOR_VERSION)
-
-dynm = env.SharedLibrary( "mongoc" , mSharedObjs )
-dynb = bsonEnv.SharedLibrary( "bson" , bSharedObjs )
-
+ dynm = env.SharedLibrary( "mongoc" , mSharedObjs )
+ dynb = bsonEnv.SharedLibrary( "bson" , bSharedObjs )
+else:
+ dynm = env.SharedLibrary( "mongoc" , mSharedObjs )
+ dynb = env.SharedLibrary( "bson" , bSharedObjs )
# ---- Install ----
if os.sys.platform == "darwin":
View
@@ -32,7 +32,7 @@ static const int zero = 0;
/* Custom standard function pointers. */
void *( *bson_malloc_func )( size_t ) = malloc;
void *( *bson_realloc_func )( void *, size_t ) = realloc;
-void ( *bson_free )( void * ) = free;
+void ( *bson_free_func )( void * ) = free;
#ifdef R_SAFETY_NET
bson_printf_func bson_printf;
#else
@@ -973,6 +973,10 @@ MONGO_EXPORT bson_err_handler set_bson_err_handler( bson_err_handler func ) {
return old;
}
+MONGO_EXPORT void bson_free( void *ptr ) {
+ bson_malloc_func( ptr );
+}
+
MONGO_EXPORT void *bson_malloc( int size ) {
void *p;
p = bson_malloc_func( size );
View
@@ -959,13 +959,15 @@ typedef int (*bson_sprintf_func)( char *, const char *, ... );
extern void *( *bson_malloc_func )( size_t );
extern void *( *bson_realloc_func )( void *, size_t );
-extern void ( *bson_free )( void * );
+extern void ( *bson_free_func )( void * );
extern bson_printf_func bson_printf;
extern bson_fprintf_func bson_fprintf;
extern bson_sprintf_func bson_sprintf;
extern bson_printf_func bson_errprintf;
+MONGO_EXPORT void bson_free( void *ptr );
+
/**
* Allocates memory and checks return value, exiting fatally if malloc() fails.
*
View
@@ -24,20 +24,15 @@
#include <ws2tcpip.h> // send,recv,socklen_t etc
#include <wspiapi.h> // addrinfo
#else
-#include <windows.h>
-#include <winsock.h>
+#include <ws2tcpip.h> // send,recv,socklen_t etc
+#include <winsock2.h>
typedef int socklen_t;
#endif
#ifndef NI_MAXSERV
# define NI_MAXSERV 32
#endif
-static void mongo_clear_errors( mongo *conn ) {
- conn->err = 0;
- memset( conn->errstr, 0, MONGO_ERR_LEN );
-}
-
int mongo_env_close_socket( int socket ) {
return closesocket( socket );
}
View
@@ -1399,7 +1399,7 @@ MONGO_EXPORT int mongo_create_index( mongo *conn, const char *ns, const bson *ke
return mongo_cmd_get_last_error( conn, idxns, out );
}
-bson_bool_t mongo_create_simple_index( mongo *conn, const char *ns, const char *field, int options, bson *out ) {
+MONGO_EXPORT bson_bool_t mongo_create_simple_index( mongo *conn, const char *ns, const char *field, int options, bson *out ) {
bson b;
bson_bool_t success;
View
@@ -645,7 +645,7 @@ MONGO_EXPORT int mongo_create_capped_collection( mongo *conn, const char *db,
*
* @return true if the index was created.
*/
-bson_bool_t mongo_create_simple_index( mongo *conn, const char *ns,
+MONGO_EXPORT bson_bool_t mongo_create_simple_index( mongo *conn, const char *ns,
const char *field, int options, bson *out );
/**

0 comments on commit 6bf161f

Please sign in to comment.