From 5fd81cee37f6ecf48dd99a828ddc22c57ffa106a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 11 Apr 2002 14:35:16 +0000 Subject: [PATCH] Explicitly specify the SDL API calling convention (C by default) --- include/SDL.h | 10 +-- include/SDL_active.h | 2 +- include/SDL_audio.h | 29 ++++---- include/SDL_cdrom.h | 22 +++--- include/SDL_endian.h | 24 +++---- include/SDL_error.h | 6 +- include/SDL_events.h | 16 ++--- include/SDL_getenv.h | 4 +- include/SDL_joystick.h | 32 ++++----- include/SDL_keyboard.h | 12 ++-- include/SDL_main.h | 6 +- include/SDL_mouse.h | 16 ++--- include/SDL_mutex.h | 34 ++++----- include/SDL_rwops.h | 10 +-- include/SDL_syswm.h | 2 +- include/SDL_thread.h | 10 +-- include/SDL_timer.h | 14 ++-- include/SDL_version.h | 2 +- include/SDL_video.h | 114 +++++++++++++++--------------- include/begin_code.h | 14 ++++ src/main/beos/exports/genexp.pl | 4 +- src/main/macos/exports/gendef.pl | 4 +- src/main/macosx/exports/gendef.pl | 4 +- src/main/win32/exports/gendef.pl | 4 +- 24 files changed, 200 insertions(+), 195 deletions(-) diff --git a/include/SDL.h b/include/SDL.h index 743ec49df..0843a0d5a 100644 --- a/include/SDL.h +++ b/include/SDL.h @@ -69,24 +69,24 @@ extern "C" { * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup * signal handlers for some commonly ignored fatal signals (like SIGSEGV) */ -extern DECLSPEC int SDL_Init(Uint32 flags); +extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); /* This function initializes specific SDL subsystems */ -extern DECLSPEC int SDL_InitSubSystem(Uint32 flags); +extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); /* This function cleans up specific SDL subsystems */ -extern DECLSPEC void SDL_QuitSubSystem(Uint32 flags); +extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); /* This function returns mask of the specified subsystems which have been initialized. If 'flags' is 0, it returns a mask of all initialized subsystems. */ -extern DECLSPEC Uint32 SDL_WasInit(Uint32 flags); +extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); /* This function cleans up all initialized subsystems and unloads the * dynamically linked library. You should call it upon all exit conditions. */ -extern DECLSPEC void SDL_Quit(void); +extern DECLSPEC void SDLCALL SDL_Quit(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL_active.h b/include/SDL_active.h index 9671acdbf..83c7c6478 100644 --- a/include/SDL_active.h +++ b/include/SDL_active.h @@ -48,7 +48,7 @@ extern "C" { * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to * see your application, otherwise it has been iconified or disabled. */ -extern DECLSPEC Uint8 SDL_GetAppState(void); +extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_audio.h b/include/SDL_audio.h index 6c5202d4c..98cef5559 100644 --- a/include/SDL_audio.h +++ b/include/SDL_audio.h @@ -105,14 +105,14 @@ typedef struct SDL_AudioCVT { * have a specific need to specify the audio driver you want to use. * You should normally use SDL_Init() or SDL_InitSubSystem(). */ -extern DECLSPEC int SDL_AudioInit(const char *driver_name); -extern DECLSPEC void SDL_AudioQuit(void); +extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); +extern DECLSPEC void SDLCALL SDL_AudioQuit(void); /* This function fills the given character buffer with the name of the * current audio driver, and returns a pointer to it if the audio driver has * been initialized. It returns NULL if no driver has been initialized. */ -extern DECLSPEC char *SDL_AudioDriverName(char *namebuf, int maxlen); +extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen); /* * This function opens the audio device with the desired parameters, and @@ -155,7 +155,7 @@ extern DECLSPEC char *SDL_AudioDriverName(char *namebuf, int maxlen); * may modify the requested size of the audio buffer, you should allocate * any local mixing buffers after you open the audio device. */ -extern DECLSPEC int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); +extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); /* * Get the current audio state: @@ -165,7 +165,7 @@ typedef enum { SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED } SDL_audiostatus; -extern DECLSPEC SDL_audiostatus SDL_GetAudioStatus(void); +extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void); /* * This function pauses and unpauses the audio callback processing. @@ -174,7 +174,7 @@ extern DECLSPEC SDL_audiostatus SDL_GetAudioStatus(void); * data for your callback function after opening the audio device. * Silence will be written to the audio device during the pause. */ -extern DECLSPEC void SDL_PauseAudio(int pause_on); +extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); /* * This function loads a WAVE from the data source, automatically freeing @@ -193,8 +193,7 @@ extern DECLSPEC void SDL_PauseAudio(int pause_on); * wave file cannot be opened, uses an unknown data format, or is * corrupt. Currently raw and MS-ADPCM WAVE files are supported. */ -extern DECLSPEC SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, - SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); +extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); /* Compatibility convenience function -- loads a WAV from a file */ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ @@ -203,7 +202,7 @@ extern DECLSPEC SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, /* * This function frees data previously allocated with SDL_LoadWAV_RW() */ -extern DECLSPEC void SDL_FreeWAV(Uint8 *audio_buf); +extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf); /* * This function takes a source format and rate and a destination format @@ -212,7 +211,7 @@ extern DECLSPEC void SDL_FreeWAV(Uint8 *audio_buf); * to the other. * This function returns 0, or -1 if there was an error. */ -extern DECLSPEC int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, +extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate); @@ -224,7 +223,7 @@ extern DECLSPEC int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, * cvt->buf should be allocated after the cvt structure is initialized by * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. */ -extern DECLSPEC int SDL_ConvertAudio(SDL_AudioCVT *cvt); +extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt); /* * This takes two audio buffers of the playing audio format and mixes @@ -234,7 +233,7 @@ extern DECLSPEC int SDL_ConvertAudio(SDL_AudioCVT *cvt); * This is provided for convenience -- you can mix your own audio data. */ #define SDL_MIX_MAXVOLUME 128 -extern DECLSPEC void SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); +extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume); /* * The lock manipulated by these functions protects the callback function. @@ -242,13 +241,13 @@ extern DECLSPEC void SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int * callback function is not running. Do not call these from the callback * function or you will cause deadlock. */ -extern DECLSPEC void SDL_LockAudio(void); -extern DECLSPEC void SDL_UnlockAudio(void); +extern DECLSPEC void SDLCALL SDL_LockAudio(void); +extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); /* * This function shuts down audio processing and closes the audio device. */ -extern DECLSPEC void SDL_CloseAudio(void); +extern DECLSPEC void SDLCALL SDL_CloseAudio(void); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_cdrom.h b/include/SDL_cdrom.h index e70d5bb92..d95aa34ae 100644 --- a/include/SDL_cdrom.h +++ b/include/SDL_cdrom.h @@ -99,7 +99,7 @@ typedef struct SDL_CD { /* Returns the number of CD-ROM drives on the system, or -1 if SDL_Init() has not been called with the SDL_INIT_CDROM flag. */ -extern DECLSPEC int SDL_CDNumDrives(void); +extern DECLSPEC int SDLCALL SDL_CDNumDrives(void); /* Returns a human-readable, system-dependent identifier for the CD-ROM. Example: @@ -107,7 +107,7 @@ extern DECLSPEC int SDL_CDNumDrives(void); "E:" "/dev/disk/ide/1/master" */ -extern DECLSPEC const char * SDL_CDName(int drive); +extern DECLSPEC const char * SDLCALL SDL_CDName(int drive); /* Opens a CD-ROM drive for access. It returns a drive handle on success, or NULL if the drive was invalid or busy. This newly opened CD-ROM @@ -115,13 +115,13 @@ extern DECLSPEC const char * SDL_CDName(int drive); CD-ROM handle. Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. */ -extern DECLSPEC SDL_CD * SDL_CDOpen(int drive); +extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive); /* This function returns the current status of the given drive. If the drive has a CD in it, the table of contents of the CD and current play position of the CD will be stored in the SDL_CD structure. */ -extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom); +extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom); /* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play @@ -142,28 +142,28 @@ extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom); This function returns 0, or -1 if there was an error. */ -extern DECLSPEC int SDL_CDPlayTracks(SDL_CD *cdrom, +extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes); /* Play the given CD starting at 'start' frame for 'length' frames. It returns 0, or -1 if there was an error. */ -extern DECLSPEC int SDL_CDPlay(SDL_CD *cdrom, int start, int length); +extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length); /* Pause play -- returns 0, or -1 on error */ -extern DECLSPEC int SDL_CDPause(SDL_CD *cdrom); +extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom); /* Resume play -- returns 0, or -1 on error */ -extern DECLSPEC int SDL_CDResume(SDL_CD *cdrom); +extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom); /* Stop play -- returns 0, or -1 on error */ -extern DECLSPEC int SDL_CDStop(SDL_CD *cdrom); +extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom); /* Eject CD-ROM -- returns 0, or -1 on error */ -extern DECLSPEC int SDL_CDEject(SDL_CD *cdrom); +extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom); /* Closes the handle for the CD-ROM drive */ -extern DECLSPEC void SDL_CDClose(SDL_CD *cdrom); +extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_endian.h b/include/SDL_endian.h index ffa91c324..fa1014e11 100644 --- a/include/SDL_endian.h +++ b/include/SDL_endian.h @@ -124,20 +124,20 @@ static __inline__ Uint64 SDL_Swap64(Uint64 val) { #endif /* Read an item of the specified endianness and return in native format */ -extern DECLSPEC Uint16 SDL_ReadLE16(SDL_RWops *src); -extern DECLSPEC Uint16 SDL_ReadBE16(SDL_RWops *src); -extern DECLSPEC Uint32 SDL_ReadLE32(SDL_RWops *src); -extern DECLSPEC Uint32 SDL_ReadBE32(SDL_RWops *src); -extern DECLSPEC Uint64 SDL_ReadLE64(SDL_RWops *src); -extern DECLSPEC Uint64 SDL_ReadBE64(SDL_RWops *src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src); +extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src); +extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src); +extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src); /* Write an item of native format to the specified endianness */ -extern DECLSPEC int SDL_WriteLE16(SDL_RWops *dst, Uint16 value); -extern DECLSPEC int SDL_WriteBE16(SDL_RWops *dst, Uint16 value); -extern DECLSPEC int SDL_WriteLE32(SDL_RWops *dst, Uint32 value); -extern DECLSPEC int SDL_WriteBE32(SDL_RWops *dst, Uint32 value); -extern DECLSPEC int SDL_WriteLE64(SDL_RWops *dst, Uint64 value); -extern DECLSPEC int SDL_WriteBE64(SDL_RWops *dst, Uint64 value); +extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value); +extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_error.h b/include/SDL_error.h index cf506392a..8d5794461 100644 --- a/include/SDL_error.h +++ b/include/SDL_error.h @@ -37,9 +37,9 @@ extern "C" { #endif /* Public functions */ -extern DECLSPEC void SDL_SetError(const char *fmt, ...); -extern DECLSPEC char * SDL_GetError(void); -extern DECLSPEC void SDL_ClearError(void); +extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...); +extern DECLSPEC char * SDLCALL SDL_GetError(void); +extern DECLSPEC void SDLCALL SDL_ClearError(void); /* Private error message function - used internally */ #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) diff --git a/include/SDL_events.h b/include/SDL_events.h index c4b441ce1..4abf04177 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -238,7 +238,7 @@ typedef union { This function updates the event queue and internal input device state. This should only be run in the thread that sets the video mode. */ -extern DECLSPEC void SDL_PumpEvents(void); +extern DECLSPEC void SDLCALL SDL_PumpEvents(void); /* Checks the event queue for messages and optionally returns them. If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to @@ -258,26 +258,26 @@ typedef enum { SDL_GETEVENT } SDL_eventaction; /* */ -extern DECLSPEC int SDL_PeepEvents(SDL_Event *events, int numevents, +extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask); /* Polls for currently pending events, and returns 1 if there are any pending events, or 0 if there are none available. If 'event' is not NULL, the next event is removed from the queue and stored in that area. */ -extern DECLSPEC int SDL_PollEvent(SDL_Event *event); +extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event); /* Waits indefinitely for the next available event, returning 1, or 0 if there was an error while waiting for events. If 'event' is not NULL, the next event is removed from the queue and stored in that area. */ -extern DECLSPEC int SDL_WaitEvent(SDL_Event *event); +extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event); /* Add an event to the event queue. This function returns 0 if the event queue was full, or -1 if there was some other error. Returns 1 on success. */ -extern DECLSPEC int SDL_PushEvent(SDL_Event *event); +extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event); /* This function sets up a filter to process all events before they @@ -302,13 +302,13 @@ typedef int (*SDL_EventFilter)(const SDL_Event *event); If the quit event is generated by an interrupt signal, it will bypass the internal queue and be delivered to the application at the next event poll. */ -extern DECLSPEC void SDL_SetEventFilter(SDL_EventFilter filter); +extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); /* Return the current event filter - can be used to "chain" filters. If there is no event filter set, this function returns NULL. */ -extern DECLSPEC SDL_EventFilter SDL_GetEventFilter(void); +extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); /* This function allows you to set the state of processing certain events. @@ -322,7 +322,7 @@ extern DECLSPEC SDL_EventFilter SDL_GetEventFilter(void); #define SDL_IGNORE 0 #define SDL_DISABLE 0 #define SDL_ENABLE 1 -extern DECLSPEC Uint8 SDL_EventState(Uint8 type, int state); +extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_getenv.h b/include/SDL_getenv.h index 9d96f7654..42037dd46 100644 --- a/include/SDL_getenv.h +++ b/include/SDL_getenv.h @@ -14,11 +14,11 @@ extern "C" { #endif /* Put a variable of the form "name=value" into the environment */ -extern DECLSPEC int SDL_putenv(const char *variable); +extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); #define putenv(X) SDL_putenv(X) /* Retrieve a variable named "name" from the environment */ -extern DECLSPEC char *SDL_getenv(const char *name); +extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); #define getenv(X) SDL_getenv(X) /* Ends C function definitions when using C++ */ diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h index 7e57e5e61..cebd9ff34 100644 --- a/include/SDL_joystick.h +++ b/include/SDL_joystick.h @@ -52,14 +52,14 @@ typedef struct _SDL_Joystick SDL_Joystick; /* * Count the number of joysticks attached to the system */ -extern DECLSPEC int SDL_NumJoysticks(void); +extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); /* * Get the implementation dependent name of a joystick. * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. */ -extern DECLSPEC const char *SDL_JoystickName(int device_index); +extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index); /* * Open a joystick for use - the index passed as an argument refers to @@ -68,46 +68,46 @@ extern DECLSPEC const char *SDL_JoystickName(int device_index); * * This function returns a joystick identifier, or NULL if an error occurred. */ -extern DECLSPEC SDL_Joystick *SDL_JoystickOpen(int device_index); +extern DECLSPEC SDL_Joystick * SDLCALL SDLCALL SDL_JoystickOpen(int device_index); /* * Returns 1 if the joystick has been opened, or 0 if it has not. */ -extern DECLSPEC int SDL_JoystickOpened(int device_index); +extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index); /* * Get the device index of an opened joystick. */ -extern DECLSPEC int SDL_JoystickIndex(SDL_Joystick *joystick); +extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick); /* * Get the number of general axis controls on a joystick */ -extern DECLSPEC int SDL_JoystickNumAxes(SDL_Joystick *joystick); +extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick); /* * Get the number of trackballs on a joystick * Joystick trackballs have only relative motion events associated * with them and their state cannot be polled. */ -extern DECLSPEC int SDL_JoystickNumBalls(SDL_Joystick *joystick); +extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick); /* * Get the number of POV hats on a joystick */ -extern DECLSPEC int SDL_JoystickNumHats(SDL_Joystick *joystick); +extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick); /* * Get the number of buttons on a joystick */ -extern DECLSPEC int SDL_JoystickNumButtons(SDL_Joystick *joystick); +extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick); /* * Update the current state of the open joysticks. * This is called automatically by the event loop if any joystick * events are enabled. */ -extern DECLSPEC void SDL_JoystickUpdate(void); +extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); /* * Enable/disable joystick event polling. @@ -116,14 +116,14 @@ extern DECLSPEC void SDL_JoystickUpdate(void); * information. * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. */ -extern DECLSPEC int SDL_JoystickEventState(int state); +extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); /* * Get the current state of an axis control on a joystick * The state is a value ranging from -32768 to 32767. * The axis indices start at index 0. */ -extern DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); +extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); /* * Get the current state of a POV hat on a joystick @@ -141,25 +141,25 @@ extern DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); /* * The hat indices start at index 0. */ -extern DECLSPEC Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); /* * Get the ball axis change since the last poll * This returns 0, or -1 if you passed it invalid parameters. * The ball indices start at index 0. */ -extern DECLSPEC int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); +extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); /* * Get the current state of a button on a joystick * The button indices start at index 0. */ -extern DECLSPEC Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button); +extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button); /* * Close a joystick previously opened with SDL_JoystickOpen() */ -extern DECLSPEC void SDL_JoystickClose(SDL_Joystick *joystick); +extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_keyboard.h b/include/SDL_keyboard.h index 3299c7963..51db9451c 100644 --- a/include/SDL_keyboard.h +++ b/include/SDL_keyboard.h @@ -74,7 +74,7 @@ typedef struct { * If 'enable' is -1, the translation state is not changed. * It returns the previous state of keyboard translation. */ -extern DECLSPEC int SDL_EnableUNICODE(int enable); +extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable); /* * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. @@ -87,7 +87,7 @@ extern DECLSPEC int SDL_EnableUNICODE(int enable); /* * If 'delay' is set to 0, keyboard repeat is disabled. */ -extern DECLSPEC int SDL_EnableKeyRepeat(int delay, int interval); +extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval); /* * Get a snapshot of the current state of the keyboard. @@ -96,23 +96,23 @@ extern DECLSPEC int SDL_EnableKeyRepeat(int delay, int interval); * Uint8 *keystate = SDL_GetKeyState(NULL); * if ( keystate[SDLK_RETURN] ) ... is pressed. */ -extern DECLSPEC Uint8 * SDL_GetKeyState(int *numkeys); +extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys); /* * Get the current key modifier state */ -extern DECLSPEC SDLMod SDL_GetModState(void); +extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void); /* * Set the current key modifier state * This does not change the keyboard state, only the key modifier flags. */ -extern DECLSPEC void SDL_SetModState(SDLMod modstate); +extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate); /* * Get the name of an SDL virtual keysym */ -extern DECLSPEC char * SDL_GetKeyName(SDLKey key); +extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_main.h b/include/SDL_main.h index 2d98651e1..6cdad2475 100644 --- a/include/SDL_main.h +++ b/include/SDL_main.h @@ -64,9 +64,9 @@ extern "C" { #endif /* This should be called from your WinMain() function, if any */ -extern DECLSPEC void SDL_SetModuleHandle(void *hInst); +extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst); /* This can also be called, but is no longer necessary */ -extern DECLSPEC int SDL_RegisterApp(char *name, Uint32 style, void *hInst); +extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst); #ifdef __cplusplus } @@ -86,7 +86,7 @@ extern "C" { struct QDGlobals; /* This should be called from your main() function, if any */ -extern DECLSPEC void SDL_InitQuickDraw(struct QDGlobals *the_qd); +extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd); #ifdef __cplusplus } diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index 156031847..101bff036 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -56,7 +56,7 @@ typedef struct { * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * current mouse cursor position. You can pass NULL for either x or y. */ -extern DECLSPEC Uint8 SDL_GetMouseState(int *x, int *y); +extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y); /* * Retrieve the current state of the mouse. @@ -64,12 +64,12 @@ extern DECLSPEC Uint8 SDL_GetMouseState(int *x, int *y); * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * mouse deltas since the last call to SDL_GetRelativeMouseState(). */ -extern DECLSPEC Uint8 SDL_GetRelativeMouseState(int *x, int *y); +extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); /* * Set the position of the mouse cursor (generates a mouse motion event) */ -extern DECLSPEC void SDL_WarpMouse(Uint16 x, Uint16 y); +extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y); /* * Create a cursor using the specified data and mask (in MSB format). @@ -84,7 +84,7 @@ extern DECLSPEC void SDL_WarpMouse(Uint16 x, Uint16 y); * * Cursors created with this function must be freed with SDL_FreeCursor(). */ -extern DECLSPEC SDL_Cursor *SDL_CreateCursor +extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); /* @@ -92,17 +92,17 @@ extern DECLSPEC SDL_Cursor *SDL_CreateCursor * If the cursor is currently visible, the change will be immediately * represented on the display. */ -extern DECLSPEC void SDL_SetCursor(SDL_Cursor *cursor); +extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor); /* * Returns the currently active cursor. */ -extern DECLSPEC SDL_Cursor * SDL_GetCursor(void); +extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void); /* * Deallocates a cursor created with SDL_CreateCursor(). */ -extern DECLSPEC void SDL_FreeCursor(SDL_Cursor *cursor); +extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor); /* * Toggle whether or not the cursor is shown on the screen. @@ -111,7 +111,7 @@ extern DECLSPEC void SDL_FreeCursor(SDL_Cursor *cursor); * before the call, or 0 if it was not. You can query the current * state by passing a 'toggle' value of -1. */ -extern DECLSPEC int SDL_ShowCursor(int toggle); +extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); /* Used as a mask when testing buttons in buttonstate Button 1: Left mouse button diff --git a/include/SDL_mutex.h b/include/SDL_mutex.h index 9188303ba..fffc0b8e5 100644 --- a/include/SDL_mutex.h +++ b/include/SDL_mutex.h @@ -60,18 +60,18 @@ struct SDL_mutex; typedef struct SDL_mutex SDL_mutex; /* Create a mutex, initialized unlocked */ -extern DECLSPEC SDL_mutex * SDL_CreateMutex(void); +extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void); /* Lock the mutex (Returns 0, or -1 on error) */ #define SDL_LockMutex(m) SDL_mutexP(m) -extern DECLSPEC int SDL_mutexP(SDL_mutex *mutex); +extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex); /* Unlock the mutex (Returns 0, or -1 on error) */ #define SDL_UnlockMutex(m) SDL_mutexV(m) -extern DECLSPEC int SDL_mutexV(SDL_mutex *mutex); +extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex); /* Destroy a mutex */ -extern DECLSPEC void SDL_DestroyMutex(SDL_mutex *mutex); +extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -83,21 +83,21 @@ struct SDL_semaphore; typedef struct SDL_semaphore SDL_sem; /* Create a semaphore, initialized with value, returns NULL on failure. */ -extern DECLSPEC SDL_sem * SDL_CreateSemaphore(Uint32 initial_value); +extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value); /* Destroy a semaphore */ -extern DECLSPEC void SDL_DestroySemaphore(SDL_sem *sem); +extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem); /* This function suspends the calling thread until the semaphore pointed * to by sem has a positive count. It then atomically decreases the semaphore * count. */ -extern DECLSPEC int SDL_SemWait(SDL_sem *sem); +extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem); /* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. */ -extern DECLSPEC int SDL_SemTryWait(SDL_sem *sem); +extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem); /* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in @@ -105,15 +105,15 @@ extern DECLSPEC int SDL_SemTryWait(SDL_sem *sem); On some platforms this function is implemented by looping with a delay of 1 ms, and so should be avoided if possible. */ -extern DECLSPEC int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms); +extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms); /* Atomically increases the semaphore's count (not blocking), returns 0, or -1 on error. */ -extern DECLSPEC int SDL_SemPost(SDL_sem *sem); +extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem); /* Returns the current count of the semaphore */ -extern DECLSPEC Uint32 SDL_SemValue(SDL_sem *sem); +extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -125,26 +125,26 @@ struct SDL_cond; typedef struct SDL_cond SDL_cond; /* Create a condition variable */ -extern DECLSPEC SDL_cond * SDL_CreateCond(void); +extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void); /* Destroy a condition variable */ -extern DECLSPEC void SDL_DestroyCond(SDL_cond *cond); +extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond); /* Restart one of the threads that are waiting on the condition variable, returns 0 or -1 on error. */ -extern DECLSPEC int SDL_CondSignal(SDL_cond *cond); +extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond); /* Restart all threads that are waiting on the condition variable, returns 0 or -1 on error. */ -extern DECLSPEC int SDL_CondBroadcast(SDL_cond *cond); +extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond); /* Wait on the condition variable, unlocking the provided mutex. The mutex must be locked before entering this function! Returns 0 when it is signaled, or -1 on error. */ -extern DECLSPEC int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); +extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); /* Waits for at most 'ms' milliseconds, and returns 0 if the condition variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not @@ -152,7 +152,7 @@ extern DECLSPEC int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); On some platforms this function is implemented by looping with a delay of 1 ms, and so should be avoided if possible. */ -extern DECLSPEC int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); +extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL_rwops.h b/include/SDL_rwops.h index b57064969..b8ac438b8 100644 --- a/include/SDL_rwops.h +++ b/include/SDL_rwops.h @@ -87,14 +87,14 @@ typedef struct SDL_RWops { /* Functions to create SDL_RWops structures from various data sources */ -extern DECLSPEC SDL_RWops * SDL_RWFromFile(const char *file, const char *mode); +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode); -extern DECLSPEC SDL_RWops * SDL_RWFromFP(FILE *fp, int autoclose); +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose); -extern DECLSPEC SDL_RWops * SDL_RWFromMem(void *mem, int size); +extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size); -extern DECLSPEC SDL_RWops * SDL_AllocRW(void); -extern DECLSPEC void SDL_FreeRW(SDL_RWops *area); +extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void); +extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area); /* Macros to easily read and write from an SDL_RWops structure */ #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index ff0faa5ba..dba56dcb6 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -153,7 +153,7 @@ typedef struct { * returns 1 if the function is implemented. If it's not implemented, or * the version member of the 'info' structure is invalid, it returns 0. */ -extern DECLSPEC int SDL_GetWMInfo(SDL_SysWMinfo *info); +extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_thread.h b/include/SDL_thread.h index 5254e73d1..74ef6d794 100644 --- a/include/SDL_thread.h +++ b/include/SDL_thread.h @@ -50,24 +50,24 @@ struct SDL_Thread; typedef struct SDL_Thread SDL_Thread; /* Create a thread */ -extern DECLSPEC SDL_Thread * SDL_CreateThread(int (*fn)(void *), void *data); +extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data); /* Get the 32-bit thread identifier for the current thread */ -extern DECLSPEC Uint32 SDL_ThreadID(void); +extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); /* Get the 32-bit thread identifier for the specified thread, equivalent to SDL_ThreadID() if the specified thread is NULL. */ -extern DECLSPEC Uint32 SDL_GetThreadID(SDL_Thread *thread); +extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); /* Wait for a thread to finish. The return code for the thread function is placed in the area pointed to by 'status', if 'status' is not NULL. */ -extern DECLSPEC void SDL_WaitThread(SDL_Thread *thread, int *status); +extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); /* Forcefully kill a thread without worrying about its state */ -extern DECLSPEC void SDL_KillThread(SDL_Thread *thread); +extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); /* Ends C function definitions when using C++ */ diff --git a/include/SDL_timer.h b/include/SDL_timer.h index 0689978ab..3fb17b388 100644 --- a/include/SDL_timer.h +++ b/include/SDL_timer.h @@ -48,13 +48,13 @@ extern "C" { /* Get the number of milliseconds since the SDL library initialization. * Note that this value wraps if the program runs for more than ~49 days. */ -extern DECLSPEC Uint32 SDL_GetTicks(void); +extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); /* Wait a specified number of milliseconds before returning */ -extern DECLSPEC void SDL_Delay(Uint32 ms); +extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); /* Function prototype for the timer callback function */ -typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); +typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval); /* Set a callback to run after the specified number of milliseconds has * elapsed. The callback function is passed the current timer interval @@ -82,7 +82,7 @@ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); * should not use this function in multi-threaded applications as signals * to multi-threaded apps have undefined behavior in some implementations. */ -extern DECLSPEC int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); +extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); /* New timer API, supports multiple timers * Written by Stephane Peter @@ -94,7 +94,7 @@ extern DECLSPEC int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); * passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is cancelled. */ -typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param); +typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param); /* Definition of the timer ID type */ typedef struct _SDL_TimerID *SDL_TimerID; @@ -102,12 +102,12 @@ typedef struct _SDL_TimerID *SDL_TimerID; /* Add a new timer to the pool of timers already running. Returns a timer ID, or NULL when an error occurs. */ -extern DECLSPEC SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); +extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); /* Remove one of the multiple timers knowing its ID. * Returns a boolean value indicating success. */ -extern DECLSPEC SDL_bool SDL_RemoveTimer(SDL_TimerID t); +extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL_version.h b/include/SDL_version.h index 91566bb07..f45d00fbd 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -79,7 +79,7 @@ typedef struct { it should NOT be used to fill a version structure, instead you should use the SDL_Version() macro. */ -extern DECLSPEC const SDL_version * SDL_Linked_Version(void); +extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL_video.h b/include/SDL_video.h index 2ec06528d..3094c7ad6 100644 --- a/include/SDL_video.h +++ b/include/SDL_video.h @@ -237,14 +237,14 @@ typedef enum { * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, * you won't be able to set full-screen display modes. */ -extern DECLSPEC int SDL_VideoInit(const char *driver_name, Uint32 flags); -extern DECLSPEC void SDL_VideoQuit(void); +extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags); +extern DECLSPEC void SDLCALL SDL_VideoQuit(void); /* This function fills the given character buffer with the name of the * video driver, and returns a pointer to it if the video driver has * been initialized. It returns NULL if no driver has been initialized. */ -extern DECLSPEC char *SDL_VideoDriverName(char *namebuf, int maxlen); +extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen); /* * This function returns a pointer to the current display surface. @@ -252,7 +252,7 @@ extern DECLSPEC char *SDL_VideoDriverName(char *namebuf, int maxlen); * function returns the publicly visible surface, not the real video * surface. */ -extern DECLSPEC SDL_Surface * SDL_GetVideoSurface(void); +extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void); /* * This function returns a read-only pointer to information about the @@ -260,7 +260,7 @@ extern DECLSPEC SDL_Surface * SDL_GetVideoSurface(void); * member of the returned structure will contain the pixel format of the * "best" video mode. */ -extern DECLSPEC const SDL_VideoInfo * SDL_GetVideoInfo(void); +extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void); /* * Check to see if a particular video mode is supported. @@ -273,7 +273,7 @@ extern DECLSPEC const SDL_VideoInfo * SDL_GetVideoInfo(void); * The arguments to SDL_VideoModeOK() are the same ones you would pass to * SDL_SetVideoMode() */ -extern DECLSPEC int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); +extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); /* * Return a pointer to an array of available screen dimensions for the @@ -284,7 +284,7 @@ extern DECLSPEC int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags * If 'format' is NULL, the mode list will be for the format given * by SDL_GetVideoInfo()->vfmt */ -extern DECLSPEC SDL_Rect ** SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); +extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); /* * Set up a video mode with the specified width, height and bits-per-pixel. @@ -344,7 +344,7 @@ extern DECLSPEC SDL_Rect ** SDL_ListModes(SDL_PixelFormat *format, Uint32 flags) * SDL will fall back to reduced functionality if the exact flags you wanted * are not available. */ -extern DECLSPEC SDL_Surface *SDL_SetVideoMode +extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags); /* @@ -353,9 +353,9 @@ extern DECLSPEC SDL_Surface *SDL_SetVideoMode * screen. * These functions should not be called while 'screen' is locked. */ -extern DECLSPEC void SDL_UpdateRects +extern DECLSPEC void SDLCALL SDL_UpdateRects (SDL_Surface *screen, int numrects, SDL_Rect *rects); -extern DECLSPEC void SDL_UpdateRect +extern DECLSPEC void SDLCALL SDL_UpdateRect (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); /* @@ -368,7 +368,7 @@ extern DECLSPEC void SDL_UpdateRect * setting the video mode for this function to perform hardware flipping. * This function returns 0 if successful, or -1 if there was an error. */ -extern DECLSPEC int SDL_Flip(SDL_Surface *screen); +extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen); /* * Set the gamma correction for each of the color channels. @@ -378,7 +378,7 @@ extern DECLSPEC int SDL_Flip(SDL_Surface *screen); * be emulated using gamma ramps, if available. If successful, this * function returns 0, otherwise it returns -1. */ -extern DECLSPEC int SDL_SetGamma(float red, float green, float blue); +extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue); /* * Set the gamma translation table for the red, green, and blue channels @@ -392,7 +392,7 @@ extern DECLSPEC int SDL_SetGamma(float red, float green, float blue); * hardware does not support gamma translation, or otherwise fails, * this function will return -1. */ -extern DECLSPEC int SDL_SetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); +extern DECLSPEC int SDLCALL SDL_SetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); /* * Retrieve the current values of the gamma translation tables. @@ -403,7 +403,7 @@ extern DECLSPEC int SDL_SetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); * hardware does not support gamma translation, or otherwise fails, * this function will return -1. */ -extern DECLSPEC int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); +extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); /* * Sets a portion of the colormap for the given 8-bit surface. If 'surface' @@ -420,7 +420,7 @@ extern DECLSPEC int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); * you desire, even if the window colormap has to be warped or run under * emulation. */ -extern DECLSPEC int SDL_SetColors(SDL_Surface *surface, +extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors); /* @@ -439,32 +439,32 @@ extern DECLSPEC int SDL_SetColors(SDL_Surface *surface, * SDL_SetColors() is equivalent to calling this function with * flags = (SDL_LOGPAL|SDL_PHYSPAL). */ -extern DECLSPEC int SDL_SetPalette(SDL_Surface *surface, int flags, +extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors); /* * Maps an RGB triple to an opaque pixel value for a given pixel format */ -extern DECLSPEC Uint32 SDL_MapRGB +extern DECLSPEC Uint32 SDLCALL SDL_MapRGB (SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); /* * Maps an RGBA quadruple to a pixel value for a given pixel format */ -extern DECLSPEC Uint32 SDL_MapRGBA(SDL_PixelFormat *format, +extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /* * Maps a pixel value into the RGB components for a given pixel format */ -extern DECLSPEC void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, +extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b); /* * Maps a pixel value into the RGBA components for a given pixel format */ -extern DECLSPEC void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, +extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); /* @@ -502,13 +502,13 @@ extern DECLSPEC void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, * the SDL_HWSURFACE flag set, and will be created in system memory instead. */ #define SDL_AllocSurface SDL_CreateRGBSurface -extern DECLSPEC SDL_Surface *SDL_CreateRGBSurface +extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); -extern DECLSPEC SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, +extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); -extern DECLSPEC void SDL_FreeSurface(SDL_Surface *surface); +extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface); /* * SDL_LockSurface() sets up a surface for directly accessing the pixels. @@ -528,8 +528,8 @@ extern DECLSPEC void SDL_FreeSurface(SDL_Surface *surface); * * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. */ -extern DECLSPEC int SDL_LockSurface(SDL_Surface *surface); -extern DECLSPEC void SDL_UnlockSurface(SDL_Surface *surface); +extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface); +extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); /* * Load a surface from a seekable SDL data source (memory or file.) @@ -537,7 +537,7 @@ extern DECLSPEC void SDL_UnlockSurface(SDL_Surface *surface); * Returns the new surface, or NULL if there was an error. * The new surface should be freed with SDL_FreeSurface(). */ -extern DECLSPEC SDL_Surface * SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); +extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); /* Convenience macro -- load a surface from a file */ #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) @@ -547,7 +547,7 @@ extern DECLSPEC SDL_Surface * SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); * If 'freedst' is non-zero, the source will be closed after being written. * Returns 0 if successful or -1 if there was an error. */ -extern DECLSPEC int SDL_SaveBMP_RW +extern DECLSPEC int SDLCALL SDL_SaveBMP_RW (SDL_Surface *surface, SDL_RWops *dst, int freedst); /* Convenience macro -- save a surface to a file */ @@ -563,7 +563,7 @@ extern DECLSPEC int SDL_SaveBMP_RW * If 'flag' is 0, this function clears any current color key. * This function returns 0, or -1 if there was an error. */ -extern DECLSPEC int SDL_SetColorKey +extern DECLSPEC int SDLCALL SDL_SetColorKey (SDL_Surface *surface, Uint32 flag, Uint32 key); /* @@ -579,7 +579,7 @@ extern DECLSPEC int SDL_SetColorKey * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. */ -extern DECLSPEC int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); +extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); /* * Sets the clipping rectangle for the destination surface in a blit. @@ -593,14 +593,14 @@ extern DECLSPEC int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha) * Note that blits are automatically clipped to the edges of the source * and destination surfaces. */ -extern DECLSPEC SDL_bool SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); +extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect); /* * Gets the clipping rectangle for the destination surface in a blit. * 'rect' must be a pointer to a valid rectangle which will be filled * with the correct values. */ -extern DECLSPEC void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); +extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); /* * Creates a new surface of the specified format, and then copies and maps @@ -614,7 +614,7 @@ extern DECLSPEC void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); * * This function is used internally by SDL_DisplayFormat(). */ -extern DECLSPEC SDL_Surface *SDL_ConvertSurface +extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); /* @@ -691,13 +691,13 @@ extern DECLSPEC SDL_Surface *SDL_ConvertSurface /* This is the public blit function, SDL_BlitSurface(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlit() */ -extern DECLSPEC int SDL_UpperBlit +extern DECLSPEC int SDLCALL SDL_UpperBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); /* This is a semi-private blit function and it performs low-level surface blitting only. */ -extern DECLSPEC int SDL_LowerBlit +extern DECLSPEC int SDLCALL SDL_LowerBlit (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); @@ -710,7 +710,7 @@ extern DECLSPEC int SDL_LowerBlit * can be generated by the SDL_MapRGB() function. * This function returns 0 on success, or -1 on error. */ -extern DECLSPEC int SDL_FillRect +extern DECLSPEC int SDLCALL SDL_FillRect (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); /* @@ -724,7 +724,7 @@ extern DECLSPEC int SDL_FillRect * * If the conversion fails or runs out of memory, it returns NULL */ -extern DECLSPEC SDL_Surface * SDL_DisplayFormat(SDL_Surface *surface); +extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface); /* * This function takes a surface and copies it to a new surface of the @@ -738,7 +738,7 @@ extern DECLSPEC SDL_Surface * SDL_DisplayFormat(SDL_Surface *surface); * * If the conversion fails or runs out of memory, it returns NULL */ -extern DECLSPEC SDL_Surface * SDL_DisplayFormatAlpha(SDL_Surface *surface); +extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -750,12 +750,12 @@ extern DECLSPEC SDL_Surface * SDL_DisplayFormatAlpha(SDL_Surface *surface); the contents of the display surface underneath the area where the overlay is shown is undefined - it may be overwritten with the converted YUV data. */ -extern DECLSPEC SDL_Overlay *SDL_CreateYUVOverlay(int width, int height, +extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height, Uint32 format, SDL_Surface *display); /* Lock an overlay for direct access, and unlock it when you are done */ -extern DECLSPEC int SDL_LockYUVOverlay(SDL_Overlay *overlay); -extern DECLSPEC void SDL_UnlockYUVOverlay(SDL_Overlay *overlay); +extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay); +extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay); /* Blit a video overlay to the display surface. The contents of the video surface underneath the blit destination are @@ -763,10 +763,10 @@ extern DECLSPEC void SDL_UnlockYUVOverlay(SDL_Overlay *overlay); The width and height of the destination rectangle may be different from that of the overlay, but currently only 2x scaling is supported. */ -extern DECLSPEC int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); +extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); /* Free a video overlay */ -extern DECLSPEC void SDL_FreeYUVOverlay(SDL_Overlay *overlay); +extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -783,17 +783,17 @@ extern DECLSPEC void SDL_FreeYUVOverlay(SDL_Overlay *overlay); * * This is disabled in default builds of SDL. */ -extern DECLSPEC int SDL_GL_LoadLibrary(const char *path); +extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); /* * Get the address of a GL function (for extension functions) */ -extern DECLSPEC void *SDL_GL_GetProcAddress(const char* proc); +extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc); /* * Set an attribute of the OpenGL subsystem before intialization. */ -extern DECLSPEC int SDL_GL_SetAttribute(SDL_GLattr attr, int value); +extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /* * Get an attribute of the OpenGL subsystem from the windowing @@ -804,20 +804,20 @@ extern DECLSPEC int SDL_GL_SetAttribute(SDL_GLattr attr, int value); * Developers should track the values they pass into SDL_GL_SetAttribute * themselves if they want to retrieve these values. */ -extern DECLSPEC int SDL_GL_GetAttribute(SDL_GLattr attr, int* value); +extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value); /* * Swap the OpenGL buffers, if double-buffering is supported. */ -extern DECLSPEC void SDL_GL_SwapBuffers(void); +extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void); /* * Internal functions that should not be called unless you have read * and understood the source code for these functions. */ -extern DECLSPEC void SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); -extern DECLSPEC void SDL_GL_Lock(void); -extern DECLSPEC void SDL_GL_Unlock(void); +extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); +extern DECLSPEC void SDLCALL SDL_GL_Lock(void); +extern DECLSPEC void SDLCALL SDL_GL_Unlock(void); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* These functions allow interaction with the window manager, if any. */ @@ -826,8 +826,8 @@ extern DECLSPEC void SDL_GL_Unlock(void); /* * Sets/Gets the title and icon text of the display window */ -extern DECLSPEC void SDL_WM_SetCaption(const char *title, const char *icon); -extern DECLSPEC void SDL_WM_GetCaption(char **title, char **icon); +extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon); +extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); /* * Sets the icon for the display window. @@ -835,14 +835,14 @@ extern DECLSPEC void SDL_WM_GetCaption(char **title, char **icon); * It takes an icon surface, and a mask in MSB format. * If 'mask' is NULL, the entire icon surface will be used as the icon. */ -extern DECLSPEC void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); +extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); /* * This function iconifies the window, and returns 1 if it succeeded. * If the function succeeds, it generates an SDL_APPACTIVE loss event. * This function is a noop and returns 0 in non-windowed environments. */ -extern DECLSPEC int SDL_WM_IconifyWindow(void); +extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); /* * Toggle fullscreen mode without changing the contents of the screen. @@ -859,7 +859,7 @@ extern DECLSPEC int SDL_WM_IconifyWindow(void); * * This is currently only implemented in the X11 video driver. */ -extern DECLSPEC int SDL_WM_ToggleFullScreen(SDL_Surface *surface); +extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface); /* * This function allows you to set and query the input grab state of @@ -876,10 +876,10 @@ typedef enum { * and nearly all keyboard input is passed directly to the application, * and not interpreted by a window manager, if any. */ -extern DECLSPEC SDL_GrabMode SDL_WM_GrabInput(SDL_GrabMode mode); +extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode); /* Not in public API at the moment - do not use! */ -extern DECLSPEC int SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, +extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect); /* Ends C function definitions when using C++ */ diff --git a/include/begin_code.h b/include/begin_code.h index acb4f8d2d..00cdab996 100644 --- a/include/begin_code.h +++ b/include/begin_code.h @@ -31,6 +31,11 @@ #endif #define _begin_code_h +/* Make sure the correct platform symbols are defined */ +#if !defined(WIN32) && defined(_WIN32) +#define WIN32 +#endif /* Windows */ + /* Some compilers use a special export keyword */ #ifndef DECLSPEC # ifdef __BEOS__ @@ -56,6 +61,15 @@ # endif #endif +/* By default SDL uses the C calling convention */ +#ifndef SDLCALL +#ifdef WIN32 +#define SDLCALL __cdecl +#else +#define SDLCALL +#endif +#endif /* SDLCALL */ + /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC diff --git a/src/main/beos/exports/genexp.pl b/src/main/beos/exports/genexp.pl index 945b4c942..cc09c433a 100755 --- a/src/main/beos/exports/genexp.pl +++ b/src/main/beos/exports/genexp.pl @@ -9,9 +9,7 @@ } $file =~ s,.*/,,; while () { - if ( /DECLSPEC.*\s\**([^\s\(]+)\(/ ) { - print "_$1\n"; - } elsif ( /DECLSPEC.*\s\**([^\s\(]+)$/ ) { + if ( /DECLSPEC.*SDLCALL ([^\s\(]+)/ ) { print "_$1\n"; } } diff --git a/src/main/macos/exports/gendef.pl b/src/main/macos/exports/gendef.pl index 3e3d94876..3479d69a2 100644 --- a/src/main/macos/exports/gendef.pl +++ b/src/main/macos/exports/gendef.pl @@ -10,9 +10,7 @@ $printed_header = 0; $file =~ s,.*/,,; while () { - if ( /DECLSPEC.*\s\**([^\s\(]+)\(/ ) { - print "\t$1\n"; - } elsif ( /DECLSPEC.*\s\**([^\s\(]+)$/ ) { + if ( /DECLSPEC.*SDLCALL ([^\s\(]+)/ ) { print "\t$1\n"; } } diff --git a/src/main/macosx/exports/gendef.pl b/src/main/macosx/exports/gendef.pl index 82c0710cc..e031a72ea 100644 --- a/src/main/macosx/exports/gendef.pl +++ b/src/main/macosx/exports/gendef.pl @@ -10,9 +10,7 @@ $printed_header = 0; $file =~ s,.*/,,; while () { - if ( /DECLSPEC.*\s\**([^\s\(]+)\(/ ) { - print "\t_$1\n"; - } elsif ( /DECLSPEC.*\s\**([^\s\(]+)$/ ) { + if ( /DECLSPEC.*SDLCALL ([^\s\(]+)/ ) { print "\t_$1\n"; } } diff --git a/src/main/win32/exports/gendef.pl b/src/main/win32/exports/gendef.pl index 1d2f554dd..73896b983 100755 --- a/src/main/win32/exports/gendef.pl +++ b/src/main/win32/exports/gendef.pl @@ -10,9 +10,7 @@ $printed_header = 0; $file =~ s,.*/,,; while () { - if ( /DECLSPEC.*\s\**([^\s\(]+)\(/ ) { - print "\t$1\n"; - } elsif ( /DECLSPEC.*\s\**([^\s\(]+)$/ ) { + if ( /DECLSPEC.*SDLCALL ([^\s\(]+)/ ) { print "\t$1\n"; } }