diff --git a/src/xpdev/threadwrap.c b/src/xpdev/threadwrap.c index e68664a66aac54644cd8a29bb588e6282492d539..bd986075c864d56b4d1dce9d1ece166052aa27bb 100644 --- a/src/xpdev/threadwrap.c +++ b/src/xpdev/threadwrap.c @@ -52,7 +52,7 @@ /****************************************************************************/ #if defined(__unix__) #if defined(_POSIX_THREADS) -ulong _beginthread(void( *start_address )( void * ) +ulong DLLCALL _beginthread(void( *start_address )( void * ) ,unsigned stack_size, void *arglist) { pthread_t thread; @@ -104,7 +104,7 @@ ulong _beginthread(void( *start_address )( void * ) /****************************************************************************/ /* Wrappers for POSIX thread (pthread) mutexes */ /****************************************************************************/ -pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive) +pthread_mutex_t DLLCALL pthread_mutex_initializer_np(BOOL recursive) { pthread_mutex_t mutex; #if defined(_POSIX_THREADS) @@ -126,7 +126,7 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive) #if !defined(_POSIX_THREADS) -int pthread_mutex_init(pthread_mutex_t* mutex, void* attr) +int DLLCALL pthread_mutex_init(pthread_mutex_t* mutex, void* attr) { (void)attr; #if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX) @@ -139,7 +139,7 @@ int pthread_mutex_init(pthread_mutex_t* mutex, void* attr) #endif } -int pthread_mutex_lock(pthread_mutex_t* mutex) +int DLLCALL pthread_mutex_lock(pthread_mutex_t* mutex) { #if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX) return (WaitForSingleObject(*mutex, INFINITE)==WAIT_OBJECT_0 ? 0 : EBUSY); @@ -151,7 +151,7 @@ int pthread_mutex_lock(pthread_mutex_t* mutex) #endif } -int pthread_mutex_trylock(pthread_mutex_t* mutex) +int DLLCALL pthread_mutex_trylock(pthread_mutex_t* mutex) { #if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX) return (WaitForSingleObject(*mutex, 0)==WAIT_OBJECT_0 ? 0 : EBUSY); @@ -163,7 +163,7 @@ int pthread_mutex_trylock(pthread_mutex_t* mutex) #endif } -int pthread_mutex_unlock(pthread_mutex_t* mutex) +int DLLCALL pthread_mutex_unlock(pthread_mutex_t* mutex) { #if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX) return (ReleaseMutex(*mutex) ? 0 : GetLastError()); @@ -175,7 +175,7 @@ int pthread_mutex_unlock(pthread_mutex_t* mutex) #endif } -int pthread_mutex_destroy(pthread_mutex_t* mutex) +int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex) { #if defined(PTHREAD_MUTEX_AS_WIN32_MUTEX) return (CloseHandle(*mutex) ? 0 : GetLastError()); @@ -193,19 +193,19 @@ int pthread_mutex_destroy(pthread_mutex_t* mutex) /* Protected (thread-safe) Integers (e.g. atomic/interlocked variables) */ /************************************************************************/ -int protected_int32_init(protected_int32_t* prot, int32_t value) +int DLLCALL protected_int32_init(protected_int32_t* prot, int32_t value) { prot->value = value; return pthread_mutex_init(&prot->mutex,NULL); } -int protected_int64_init(protected_int64_t* prot, int64_t value) +int DLLCALL protected_int64_init(protected_int64_t* prot, int64_t value) { prot->value = value; return pthread_mutex_init(&prot->mutex,NULL); } -int32_t protected_int32_adjust(protected_int32_t* i, int32_t adjustment) +int32_t DLLCALL protected_int32_adjust(protected_int32_t* i, int32_t adjustment) { int32_t newval; pthread_mutex_lock(&i->mutex); @@ -214,7 +214,7 @@ int32_t protected_int32_adjust(protected_int32_t* i, int32_t adjustment) return newval; } -uint32_t protected_uint32_adjust(protected_uint32_t* i, int32_t adjustment) +uint32_t DLLCALL protected_uint32_adjust(protected_uint32_t* i, int32_t adjustment) { uint32_t newval; pthread_mutex_lock(&i->mutex); @@ -223,7 +223,7 @@ uint32_t protected_uint32_adjust(protected_uint32_t* i, int32_t adjustment) return newval; } -int64_t protected_int64_adjust(protected_int64_t* i, int64_t adjustment) +int64_t DLLCALL protected_int64_adjust(protected_int64_t* i, int64_t adjustment) { int64_t newval; pthread_mutex_lock(&i->mutex); @@ -232,7 +232,7 @@ int64_t protected_int64_adjust(protected_int64_t* i, int64_t adjustment) return newval; } -uint64_t protected_uint64_adjust(protected_uint64_t* i, int64_t adjustment) +uint64_t DLLCALL protected_uint64_adjust(protected_uint64_t* i, int64_t adjustment) { uint64_t newval; pthread_mutex_lock(&i->mutex); diff --git a/src/xpdev/threadwrap.h b/src/xpdev/threadwrap.h index 7a4d96183be90ffe65dae43f363d8cc0da501764..866e8139f0c2448e58a01153a902d3da3f07fca1 100644 --- a/src/xpdev/threadwrap.h +++ b/src/xpdev/threadwrap.h @@ -115,11 +115,11 @@ pthread_mutex_t pthread_mutex_initializer_np(BOOL recursive); #else -int pthread_mutex_init(pthread_mutex_t*, void* attr); -int pthread_mutex_lock(pthread_mutex_t*); -int pthread_mutex_trylock(pthread_mutex_t*); -int pthread_mutex_unlock(pthread_mutex_t*); -int pthread_mutex_destroy(pthread_mutex_t*); +DLLEXPORT int DLLCALL pthread_mutex_init(pthread_mutex_t*, void* attr); +DLLEXPORT int DLLCALL pthread_mutex_lock(pthread_mutex_t*); +DLLEXPORT int DLLCALL pthread_mutex_trylock(pthread_mutex_t*); +DLLEXPORT int DLLCALL pthread_mutex_unlock(pthread_mutex_t*); +DLLEXPORT int DLLCALL pthread_mutex_destroy(pthread_mutex_t*); #define SetThreadName(c) @@ -162,19 +162,19 @@ typedef struct { } protected_uint64_t; /* Return 0 on success, non-zero on failure (see pthread_mutex_init): */ -int protected_int32_init(protected_int32_t*, int32_t value); +DLLEXPORT int DLLCALL protected_int32_init(protected_int32_t*, int32_t value); #define protected_uint32_init(i, val) protected_int32_init((protected_int32_t*)i, val) -int protected_int64_init(protected_int64_t*, int64_t value); +DLLEXPORT int DLLCALL protected_int64_init(protected_int64_t*, int64_t value); #define protected_uint64_init(i, val) protected_int64_init((protected_int64_t*)i, val) /* Return new value: */ -int32_t protected_int32_adjust(protected_int32_t*, int32_t adjustment); +DLLEXPORT int32_t DLLCALL protected_int32_adjust(protected_int32_t*, int32_t adjustment); #define protected_int32_value(i) protected_int32_adjust(&i,0) -uint32_t protected_uint32_adjust(protected_uint32_t*,int32_t adjustment); +DLLEXPORT uint32_t DLLCALL protected_uint32_adjust(protected_uint32_t*,int32_t adjustment); #define protected_uint32_value(i) protected_uint32_adjust(&i,0) -int64_t protected_int64_adjust(protected_int64_t*, int64_t adjustment); +DLLEXPORT int64_t DLLCALL protected_int64_adjust(protected_int64_t*, int64_t adjustment); #define protected_int64_value(i) protected_int64_adjust(&i,0) -uint64_t protected_uint64_adjust(protected_uint64_t*,int64_t adjustment); +DLLEXPORT uint64_t DLLCALL protected_uint64_adjust(protected_uint64_t*,int64_t adjustment); #define protected_uint64_value(i) protected_uint64_adjust(&i,0) /* Return 0 on success, non-zero on failure (see pthread_mutex_destroy): */ diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c index 64121c0c1de63d8901bcb5750acabada820cdd3d..293297a7595b96136124eb3efb7649edca7bd177 100644 --- a/src/xpdev/xpbeep.c +++ b/src/xpdev/xpbeep.c @@ -189,7 +189,7 @@ struct alsa_api_struct *alsa_api=NULL; /********************************************************************************/ /* Calculate and generate a sound wave pattern (thanks to Deuce!) */ /********************************************************************************/ -void makewave(double freq, unsigned char *wave, int samples, enum WAVE_SHAPE shape) +void DLLCALL makewave(double freq, unsigned char *wave, int samples, enum WAVE_SHAPE shape) { int i; int midpoint; @@ -315,7 +315,7 @@ static int portaudio_callback(void *inputBuffer #endif #ifdef WITH_SDL_AUDIO -void sdl_fillbuf(void *userdata, Uint8 *stream, int len) +void DLLCALL sdl_fillbuf(void *userdata, Uint8 *stream, int len) { int copylen=len; int maxlen=sdl_audio_buf_len-sdl_audio_buf_pos; @@ -340,7 +340,7 @@ void sdl_fillbuf(void *userdata, Uint8 *stream, int len) } #endif -BOOL xptone_open(void) +BOOL DLLCALL xptone_open(void) { #ifdef _WIN32 WAVEFORMATEX w; @@ -562,7 +562,7 @@ BOOL xptone_open(void) return(FALSE); } -void xptone_complete(void) +void DLLCALL xptone_complete(void) { if(handle_type==SOUND_DEVICE_CLOSED) return; @@ -614,7 +614,7 @@ void xptone_complete(void) } -BOOL xptone_close(void) +BOOL DLLCALL xptone_close(void) { xptone_complete(); #ifdef WITH_PORTAUDIO @@ -664,7 +664,7 @@ BOOL xptone_close(void) } #ifdef XPDEV_THREAD_SAFE -void xp_play_sample_thread(void *data) +void DLLCALL xp_play_sample_thread(void *data) { BOOL must_close=FALSE; BOOL posted_last=TRUE; @@ -1034,7 +1034,7 @@ void DLLCALL unix_beep(int freq, int dur) /********************************************************************************/ /* Play sound through DSP/wave device, if unsuccessful, play through PC speaker */ /********************************************************************************/ -void xpbeep(double freq, DWORD duration) +void DLLCALL xpbeep(double freq, DWORD duration) { if(xptone(freq,duration,WAVE_SHAPE_SINE_SAW_HARM)) return; diff --git a/src/xpdev/xpbeep.h b/src/xpdev/xpbeep.h index de7c5c86c0bdf479155e8eb64e5474d4d41fbb3b..8b3a4be8fe276da8098d09dc6f1b35851c01a5e3 100644 --- a/src/xpdev/xpbeep.h +++ b/src/xpdev/xpbeep.h @@ -33,14 +33,14 @@ enum WAVE_SHAPE { #ifdef __cplusplus extern "C" { #endif -BOOL xptone_open(void); -BOOL xptone_close(void); -void xpbeep(double freq, DWORD duration); -BOOL xp_play_sample(const unsigned char *sample, size_t sample_size, BOOL background); -void xptone_complete(void); -BOOL xptone(double freq, DWORD duration, enum WAVE_SHAPE); +DLLEXPORT BOOL DLLCALL xptone_open(void); +DLLEXPORT BOOL DLLCALL xptone_close(void); +DLLEXPORT void DLLCALL xpbeep(double freq, DWORD duration); +DLLEXPORT BOOL DLLCALL xp_play_sample(const unsigned char *sample, size_t sample_size, BOOL background); +DLLEXPORT void DLLCALL xptone_complete(void); +DLLEXPORT BOOL DLLCALL xptone(double freq, DWORD duration, enum WAVE_SHAPE); #ifdef __unix__ -void unix_beep(int freq, int dur); +DLLEXPORT void DLLCALL unix_beep(int freq, int dur); #endif #ifdef __cplusplus }