view Isolated/SimpleMutex.h @ 71:36644b1b940b

Removed use of dllimport for Windows. Johnson Lin reported that he was getting warnings about it. I think the problem is that I didn't handle the case where you compile the files into your project or statically link. In this case you don't want dllexport or dllimport. From what I read, dllimport is optional (an optimization hint). Since this is becoming a nuisance, I rather just remove it rather than require another build flag.
author Eric Wing <ewing . public |-at-| gmail . com>
date Wed, 20 Jun 2012 10:46:03 -0700
parents 208a9ed20087
children 398d1cb12448
line wrap: on
line source

/* Copyright: Eric Wing 2003 */

#ifndef SIMPLE_MUTEX_H
#define SIMPLE_MUTEX_H

#ifdef __cplusplus
extern "C" {
#endif

	#if defined(_WIN32)
		#if defined(SIMPLE_MUTEX_BUILD_LIBRARY)
			#define SIMPLE_MUTEX_DECLSPEC __declspec(dllexport)
		#endif
	#else
		#if defined(SIMPLE_MUTEX_BUILD_LIBRARY)
			#if defined (__GNUC__) && __GNUC__ >= 4
				#define SIMPLE_MUTEX_DECLSPEC __attribute__((visibility("default")))
			#else
				#define SIMPLE_MUTEX_DECLSPEC
			#endif
		#else
			#define SIMPLE_MUTEX_DECLSPEC
		#endif
	#endif

	#if defined(_WIN32)
		#define SIMPLE_MUTEX_CALL __cdecl
	#else
		#define SIMPLE_MUTEX_CALL
	#endif

typedef struct SimpleMutex SimpleMutex;

extern SIMPLE_MUTEX_DECLSPEC SimpleMutex* SIMPLE_MUTEX_CALL SimpleMutex_CreateMutex(void);
extern SIMPLE_MUTEX_DECLSPEC void SIMPLE_MUTEX_CALL SimpleMutex_DestroyMutex(SimpleMutex* simple_mutex);
extern SIMPLE_MUTEX_DECLSPEC int SIMPLE_MUTEX_CALL SimpleMutex_LockMutex(SimpleMutex* simple_mutex);
extern SIMPLE_MUTEX_DECLSPEC void SIMPLE_MUTEX_CALL SimpleMutex_UnlockMutex(SimpleMutex* simple_mutex);


/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif

#endif