Index: include/portaudio.h
===================================================================
--- include/portaudio.h	(revision 1304)
+++ include/portaudio.h	(working copy)
@@ -49,17 +49,29 @@
 {
 #endif /* __cplusplus */
 
- 
+
+#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) /* MSC version 6 and above */
+/* PortAudio API Calling Convention */
+/* Required if static-linked with another calling convention */
+#define PA_API_CC __fastcall
+/* Begin of PortAudio API struct packing alignment (to ensure consistent packing across projects) */
+#define PA_POP_PACK
+#pragma pack(push, pa_PACK, 4)
+#else
+#define PA_API_CC 
+#endif
+
+
 /** Retrieve the release number of the currently running PortAudio build,
  eg 1900.
 */
-int Pa_GetVersion( void );
+int PA_API_CC Pa_GetVersion( void );
 
 
 /** Retrieve a textual description of the current PortAudio build,
  eg "PortAudio V19-devel 13 October 2002".
 */
-const char* Pa_GetVersionText( void );
+const char* PA_API_CC Pa_GetVersionText( void );
 
 
 /** Error codes returned by PortAudio functions.
@@ -106,11 +118,11 @@
 /** Translate the supplied PortAudio error code into a human readable
  message.
 */
-const char *Pa_GetErrorText( PaError errorCode );
+const char * PA_API_CC Pa_GetErrorText( PaError errorCode );
 
 
 /** Library initialization function - call this before using PortAudio.
- This function initialises internal data structures and prepares underlying
+ This function initializes internal data structures and prepares underlying
  host APIs for use.  With the exception of Pa_GetVersion(), Pa_GetVersionText(),
  and Pa_GetErrorText(), this function MUST be called before using any other
  PortAudio API functions.
@@ -128,12 +140,12 @@
 
  @see Pa_Terminate
 */
-PaError Pa_Initialize( void );
+PaError PA_API_CC Pa_Initialize( void );
 
 
 /** Library termination function - call this when finished using PortAudio.
  This function deallocates all resources allocated by PortAudio since it was
- initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has
+ initialized by a call to Pa_Initialize(). In cases where Pa_Initialise() has
  been called multiple times, each call must be matched with a corresponding call
  to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically
  close any PortAudio streams that are still open.
@@ -147,7 +159,7 @@
  
  @see Pa_Initialize
 */
-PaError Pa_Terminate( void );
+PaError PA_API_CC Pa_Terminate( void );
 
 
 
@@ -195,7 +207,7 @@
 
  @see PaHostApiIndex
 */
-PaHostApiIndex Pa_GetHostApiCount( void );
+PaHostApiIndex PA_API_CC Pa_GetHostApiCount( void );
 
 
 /** Retrieve the index of the default host API. The default host API will be
@@ -206,7 +218,7 @@
  indicating the default host API index or, a PaErrorCode (which are always
  negative) if PortAudio is not initialized or an error is encountered.
 */
-PaHostApiIndex Pa_GetDefaultHostApi( void );
+PaHostApiIndex PA_API_CC Pa_GetDefaultHostApi( void );
 
 
 /** Unchanging unique identifiers for each supported host API. This type
@@ -285,7 +297,7 @@
  be manipulated or freed. The pointer is only guaranteed to be valid between
  calls to Pa_Initialize() and Pa_Terminate().
 */
-const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi );
+const PaHostApiInfo * PA_API_CC Pa_GetHostApiInfo( PaHostApiIndex hostApi );
 
 
 /** Convert a static host API unique identifier, into a runtime
@@ -303,7 +315,7 @@
 
  @see PaHostApiTypeId
 */
-PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type );
+PaHostApiIndex PA_API_CC Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type );
 
 
 /** Convert a host-API-specific device index to standard PortAudio device index.
@@ -327,7 +339,7 @@
  
  @see PaHostApiInfo
 */
-PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi,
+PaDeviceIndex PA_API_CC Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi,
         int hostApiDeviceIndex );
 
 
@@ -343,18 +355,18 @@
 
 /** Return information about the last host error encountered. The error
  information returned by Pa_GetLastHostErrorInfo() will never be modified
- asyncronously by errors occurring in other PortAudio owned threads
+ asynchronously by errors occurring in other PortAudio owned threads
  (such as the thread that manages the stream callback.)
 
  This function is provided as a last resort, primarily to enhance debugging
  by providing clients with access to all available error information.
 
- @return A pointer to an immutable structure constaining information about
+ @return A pointer to an immutable structure constraining information about
  the host error. The values in this structure will only be valid if a
  PortAudio function has previously returned the paUnanticipatedHostError
  error code.
 */
-const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void );
+const PaHostErrorInfo* PA_API_CC Pa_GetLastHostErrorInfo( void );
 
 
 
@@ -367,7 +379,7 @@
  a PaErrorCode (which are always negative) if PortAudio is not initialized
  or an error is encountered.
 */
-PaDeviceIndex Pa_GetDeviceCount( void );
+PaDeviceIndex PA_API_CC Pa_GetDeviceCount( void );
 
 
 /** Retrieve the index of the default input device. The result can be
@@ -376,13 +388,13 @@
  @return The default input device index for the default host API, or paNoDevice
  if no default input device is available or an error was encountered.
 */
-PaDeviceIndex Pa_GetDefaultInputDevice( void );
+PaDeviceIndex PA_API_CC Pa_GetDefaultInputDevice( void );
 
 
 /** Retrieve the index of the default output device. The result can be
  used in the outputDevice parameter to Pa_OpenStream().
 
- @return The default output device index for the defualt host API, or paNoDevice
+ @return The default output device index for the default host API, or paNoDevice
  if no default output device is available or an error was encountered.
 
  @note
@@ -394,11 +406,11 @@
  The user should first determine the available device ids by using
  the supplied application "pa_devs".
 */
-PaDeviceIndex Pa_GetDefaultOutputDevice( void );
+PaDeviceIndex PA_API_CC Pa_GetDefaultOutputDevice( void );
 
 
 /** The type used to represent monotonic time in seconds that can be used
- for syncronisation. The type is used for the outTime argument to the
+ for synchronization. The type is used for the outTime argument to the
  PaStreamCallback and as the result of Pa_GetStreamTime().
      
  @see PaStreamCallback, Pa_GetStreamTime
@@ -474,7 +486,7 @@
 
  @see PaDeviceInfo, PaDeviceIndex
 */
-const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device );
+const PaDeviceInfo* PA_API_CC Pa_GetDeviceInfo( PaDeviceIndex device );
 
 
 /** Parameters for one direction (input or output) of a stream.
@@ -506,8 +518,8 @@
      configure their latency based on these parameters, otherwise they may
      choose the closest viable latency instead. Unless the suggested latency
      is greater than the absolute upper limit for the device implementations
-     should round the suggestedLatency up to the next practial value - ie to
-     provide an equal or higher latency than suggestedLatency wherever possibe.
+     should round the suggestedLatency up to the next practical value - ie to
+     provide an equal or higher latency than suggestedLatency wherever possible.
      Actual latency values for an open stream may be retrieved using the
      inputLatency and outputLatency fields of the PaStreamInfo structure
      returned by Pa_GetStreamInfo().
@@ -550,9 +562,9 @@
 
  @see paFormatIsSupported, PaStreamParameters
 */
-PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
-                              const PaStreamParameters *outputParameters,
-                              double sampleRate );
+PaError PA_API_CC Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
+									const PaStreamParameters *outputParameters,
+									double sampleRate );
 
 
 
@@ -732,17 +744,17 @@
  stream will finish as soon as possible. If paComplete is returned, the stream
  will continue until all buffers generated by the callback have been played.
  This may be useful in applications such as soundfile players where a specific
- duration of output is required. However, it is not necessary to utilise this
+ duration of output is required. However, it is not necessary to utilize this
  mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also
  be used to stop the stream. The callback must always fill the entire output
  buffer irrespective of its return value.
 
  @see Pa_OpenStream, Pa_OpenDefaultStream
 
- @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call
+ @note With the exception of Pa_GetStreamCpuLoad() it is not permissible to call
  PortAudio API functions from within the stream callback.
 */
-typedef int PaStreamCallback(
+typedef int PA_API_CC PaStreamCallback(
     const void *input, void *output,
     unsigned long frameCount,
     const PaStreamCallbackTimeInfo* timeInfo,
@@ -769,7 +781,7 @@
  @param framesPerBuffer The number of frames passed to the stream callback
  function, or the preferred block granularity for a blocking read/write stream.
  The special value paFramesPerBufferUnspecified (0) may be used to request that
- the stream callback will recieve an optimal (and possibly varying) number of
+ the stream callback will receive an optimal (and possibly varying) number of
  frames based on host requirements and the requested latency settings.
  Note: With some host APIs, the use of non-zero framesPerBuffer for a callback
  stream may introduce an additional layer of buffering which could introduce
@@ -778,7 +790,7 @@
  that a non-zero framesPerBuffer value only be used when your algorithm
  requires a fixed number of frames per stream callback.
  
- @param streamFlags Flags which modify the behaviour of the streaming process.
+ @param streamFlags Flags which modify the behavior of the streaming process.
  This parameter may contain a combination of flags ORed together. Some flags may
  only be relevant to certain buffer formats.
      
@@ -804,7 +816,7 @@
  @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream,
  Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable
 */
-PaError Pa_OpenStream( PaStream** stream,
+PaError PA_API_CC Pa_OpenStream( PaStream** stream,
                        const PaStreamParameters *inputParameters,
                        const PaStreamParameters *outputParameters,
                        double sampleRate,
@@ -827,7 +839,7 @@
 
  @param numOutputChannels The number of channels of sound to be delivered to the
  stream callback or passed to Pa_WriteStream. It can range from 1 to the value
- of maxOutputChannels in the PaDeviceInfo record for the default output dvice.
+ of maxOutputChannels in the PaDeviceInfo record for the default output device.
  If 0 the stream is opened as an output-only stream.
 
  @param sampleFormat The sample format of both the input and output buffers
@@ -844,7 +856,7 @@
 
  @see Pa_OpenStream, PaStreamCallback
 */
-PaError Pa_OpenDefaultStream( PaStream** stream,
+PaError PA_API_CC Pa_OpenDefaultStream( PaStream** stream,
                               int numInputChannels,
                               int numOutputChannels,
                               PaSampleFormat sampleFormat,
@@ -857,7 +869,7 @@
 /** Closes an audio stream. If the audio stream is active it
  discards any pending buffers as if Pa_AbortStream() had been called.
 */
-PaError Pa_CloseStream( PaStream *stream );
+PaError PA_API_CC Pa_CloseStream( PaStream *stream );
 
 
 /** Functions of type PaStreamFinishedCallback are implemented by PortAudio 
@@ -874,7 +886,7 @@
 
  @see Pa_SetStreamFinishedCallback
 */
-typedef void PaStreamFinishedCallback( void *userData );
+typedef void PA_API_CC PaStreamFinishedCallback( void *userData );
 
 
 /** Register a stream finished callback function which will be called when the 
@@ -895,24 +907,24 @@
 
  @see PaStreamFinishedCallback
 */
-PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); 
+PaError PA_API_CC Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); 
 
 
 /** Commences audio processing.
 */
-PaError Pa_StartStream( PaStream *stream );
+PaError PA_API_CC Pa_StartStream( PaStream *stream );
 
 
 /** Terminates audio processing. It waits until all pending
  audio buffers have been played before it returns.
 */
-PaError Pa_StopStream( PaStream *stream );
+PaError PA_API_CC Pa_StopStream( PaStream *stream );
 
 
 /** Terminates audio processing immediately without waiting for pending
  buffers to complete.
 */
-PaError Pa_AbortStream( PaStream *stream );
+PaError PA_API_CC Pa_AbortStream( PaStream *stream );
 
 
 /** Determine whether the stream is stopped.
@@ -927,7 +939,7 @@
 
  @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive
 */
-PaError Pa_IsStreamStopped( PaStream *stream );
+PaError PA_API_CC Pa_IsStreamStopped( PaStream *stream );
 
 
 /** Determine whether the stream is active.
@@ -943,7 +955,7 @@
 
  @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped
 */
-PaError Pa_IsStreamActive( PaStream *stream );
+PaError PA_API_CC Pa_IsStreamActive( PaStream *stream );
 
 
 
@@ -997,18 +1009,18 @@
 
  @see PaStreamInfo
 */
-const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream );
+const PaStreamInfo* PA_API_CC Pa_GetStreamInfo( PaStream *stream );
 
 
 /** Determine the current time for the stream according to the same clock used
- to generate buffer timestamps. This time may be used for syncronising other
+ to generate buffer timestamps. This time may be used for synchronizing other
  events to the audio stream, for example synchronizing audio to MIDI.
                                         
  @return The stream's current time in seconds, or 0 if an error occurred.
 
  @see PaTime, PaStreamCallback
 */
-PaTime Pa_GetStreamTime( PaStream *stream );
+PaTime PA_API_CC Pa_GetStreamTime( PaStream *stream );
 
 
 /** Retrieve CPU usage information for the specified stream.
@@ -1025,9 +1037,9 @@
  to maintain real-time operation. A value of 0.5 would imply that PortAudio and
  the stream callback was consuming roughly 50% of the available CPU time. The
  return value may exceed 1.0. A value of 0.0 will always be returned for a
- blocking read/write stream, or if an error occurrs.
+ blocking read/write stream, or if an error occurs.
 */
-double Pa_GetStreamCpuLoad( PaStream* stream );
+double PA_API_CC Pa_GetStreamCpuLoad( PaStream* stream );
 
 
 /** Read samples from an input stream. The function doesn't return until
@@ -1051,7 +1063,7 @@
  @return On success PaNoError will be returned, or PaInputOverflowed if input
  data was discarded by PortAudio after the previous call and before this call.
 */
-PaError Pa_ReadStream( PaStream* stream,
+PaError PA_API_CC Pa_ReadStream( PaStream* stream,
                        void *buffer,
                        unsigned long frames );
 
@@ -1078,7 +1090,7 @@
  additional output data was inserted after the previous call and before this
  call.
 */
-PaError Pa_WriteStream( PaStream* stream,
+PaError PA_API_CC Pa_WriteStream( PaStream* stream,
                         const void *buffer,
                         unsigned long frames );
 
@@ -1091,7 +1103,7 @@
  PaErrorCode (which are always negative) if PortAudio is not initialized or an
  error is encountered.
 */
-signed long Pa_GetStreamReadAvailable( PaStream* stream );
+signed long PA_API_CC Pa_GetStreamReadAvailable( PaStream* stream );
 
 
 /** Retrieve the number of frames that can be written to the stream without
@@ -1102,7 +1114,7 @@
  PaErrorCode (which are always negative) if PortAudio is not initialized or an
  error is encountered.
 */
-signed long Pa_GetStreamWriteAvailable( PaStream* stream );
+signed long PA_API_CC Pa_GetStreamWriteAvailable( PaStream* stream );
 
 
 /* Miscellaneous utilities */
@@ -1113,7 +1125,7 @@
  @return The size in bytes of a single sample in the specified format,
  or paSampleFormatNotSupported if the format is not supported.
 */
-PaError Pa_GetSampleSize( PaSampleFormat format );
+PaError PA_API_CC Pa_GetSampleSize( PaSampleFormat format );
 
 
 /** Put the caller to sleep for at least 'msec' milliseconds. This function is
@@ -1123,10 +1135,15 @@
  The function may sleep longer than requested so don't rely on this for accurate
  musical timing.
 */
-void Pa_Sleep( long msec );
+void PA_API_CC Pa_Sleep( long msec );
 
 
 
+#ifdef PA_POP_PACK
+/* End of PortAudio API struct packing alignment */
+#pragma pack(pop, pa_PACK)
+#endif
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: src/common/pa_debugprint.c
===================================================================
--- src/common/pa_debugprint.c	(revision 1304)
+++ src/common/pa_debugprint.c	(working copy)
@@ -64,7 +64,7 @@
 static PaUtilLogCallback userCB=0;
 
 
-void PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb)
+void PA_API_CC PaUtil_SetDebugPrintFunction(PaUtilLogCallback cb)
 {
     userCB = cb;
 }
Index: src/common/pa_debugprint.h
===================================================================
--- src/common/pa_debugprint.h	(revision 1304)
+++ src/common/pa_debugprint.h	(working copy)
@@ -39,6 +39,7 @@
  @ingroup common_src
 */
 
+#include "portaudio.h"		/* Required for PA_API_CC */
 
 #ifdef __cplusplus
 extern "C"
@@ -134,12 +135,12 @@
 #endif
 
     
-typedef void (*PaUtilLogCallback ) (const char *log);
+typedef void (PA_API_CC *PaUtilLogCallback ) (const char *log);
 
 /**
     Install user provided log function
 */
-void PaUtil_SetDebugPrintFunction(PaUtilLogCallback  cb);
+void PA_API_CC PaUtil_SetDebugPrintFunction(PaUtilLogCallback  cb);
 
 
 
Index: src/common/pa_front.c
===================================================================
--- src/common/pa_front.c	(revision 1304)
+++ src/common/pa_front.c	(working copy)
@@ -92,13 +92,13 @@
 
 
 
-int Pa_GetVersion( void )
+int PA_API_CC Pa_GetVersion( void )
 {
     return PA_VERSION_;
 }
 
 
-const char* Pa_GetVersionText( void )
+const char* PA_API_CC Pa_GetVersionText( void )
 {
     return PA_VERSION_TEXT_;
 }
@@ -305,7 +305,7 @@
 }
 
 
-PaError Pa_Initialize( void )
+PaError PA_API_CC Pa_Initialize( void )
 {
     PaError result;
 
@@ -335,7 +335,7 @@
 }
 
 
-PaError Pa_Terminate( void )
+PaError PA_API_CC Pa_Terminate( void )
 {
     PaError result;
 
@@ -364,13 +364,13 @@
 }
 
 
-const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void )
+const PaHostErrorInfo* PA_API_CC Pa_GetLastHostErrorInfo( void )
 {
     return &lastHostErrorInfo_;
 }
 
 
-const char *Pa_GetErrorText( PaError errorCode )
+const char * PA_API_CC Pa_GetErrorText( PaError errorCode )
 {
     const char *result;
 
@@ -416,7 +416,7 @@
 }
 
 
-PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type )
+PaHostApiIndex PA_API_CC Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type )
 {
     PaHostApiIndex result;
     int i;
@@ -499,7 +499,7 @@
 }
 
 
-PaHostApiIndex Pa_GetHostApiCount( void )
+PaHostApiIndex PA_API_CC Pa_GetHostApiCount( void )
 {
     int result;
 
@@ -520,7 +520,7 @@
 }
 
 
-PaHostApiIndex Pa_GetDefaultHostApi( void )
+PaHostApiIndex PA_API_CC Pa_GetDefaultHostApi( void )
 {
     int result;
 
@@ -549,7 +549,7 @@
 }
 
 
-const PaHostApiInfo* Pa_GetHostApiInfo( PaHostApiIndex hostApi )
+const PaHostApiInfo* PA_API_CC Pa_GetHostApiInfo( PaHostApiIndex hostApi )
 {
     PaHostApiInfo *info;
 
@@ -590,7 +590,7 @@
 }
 
 
-PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi, int hostApiDeviceIndex )
+PaDeviceIndex PA_API_CC Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi, int hostApiDeviceIndex )
 {
     PaDeviceIndex result;
 
@@ -628,7 +628,7 @@
 }
 
 
-PaDeviceIndex Pa_GetDeviceCount( void )
+PaDeviceIndex PA_API_CC Pa_GetDeviceCount( void )
 {
     PaDeviceIndex result;
 
@@ -649,7 +649,7 @@
 }
 
 
-PaDeviceIndex Pa_GetDefaultInputDevice( void )
+PaDeviceIndex PA_API_CC Pa_GetDefaultInputDevice( void )
 {
     PaHostApiIndex hostApi;
     PaDeviceIndex result;
@@ -672,7 +672,7 @@
 }
 
 
-PaDeviceIndex Pa_GetDefaultOutputDevice( void )
+PaDeviceIndex PA_API_CC Pa_GetDefaultOutputDevice( void )
 {
     PaHostApiIndex hostApi;
     PaDeviceIndex result;
@@ -695,7 +695,7 @@
 }
 
 
-const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device )
+const PaDeviceInfo* PA_API_CC Pa_GetDeviceInfo( PaDeviceIndex device )
 {
     int hostSpecificDeviceIndex;
     int hostApiIndex = FindHostApi( device, &hostSpecificDeviceIndex );
@@ -980,7 +980,7 @@
 }
 
 
-PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
+PaError PA_API_CC Pa_IsFormatSupported( const PaStreamParameters *inputParameters,
                               const PaStreamParameters *outputParameters,
                               double sampleRate )
 {
@@ -1084,7 +1084,7 @@
 }
 
 
-PaError Pa_OpenStream( PaStream** stream,
+PaError PA_API_CC Pa_OpenStream( PaStream** stream,
                        const PaStreamParameters *inputParameters,
                        const PaStreamParameters *outputParameters,
                        double sampleRate,
@@ -1218,7 +1218,7 @@
 }
 
 
-PaError Pa_OpenDefaultStream( PaStream** stream,
+PaError PA_API_CC Pa_OpenDefaultStream( PaStream** stream,
                               int inputChannelCount,
                               int outputChannelCount,
                               PaSampleFormat sampleFormat,
@@ -1314,7 +1314,7 @@
 }
 
 
-PaError Pa_CloseStream( PaStream* stream )
+PaError PA_API_CC Pa_CloseStream( PaStream* stream )
 {
     PaUtilStreamInterface *interface;
     PaError result = PaUtil_ValidateStreamPointer( stream );
@@ -1348,7 +1348,7 @@
 }
 
 
-PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback )
+PaError PA_API_CC Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback )
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
@@ -1377,7 +1377,7 @@
 }
 
 
-PaError Pa_StartStream( PaStream *stream )
+PaError PA_API_CC Pa_StartStream( PaStream *stream )
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
@@ -1403,7 +1403,7 @@
 }
 
 
-PaError Pa_StopStream( PaStream *stream )
+PaError PA_API_CC Pa_StopStream( PaStream *stream )
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
@@ -1429,7 +1429,7 @@
 }
 
 
-PaError Pa_AbortStream( PaStream *stream )
+PaError PA_API_CC Pa_AbortStream( PaStream *stream )
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
@@ -1455,7 +1455,7 @@
 }
 
 
-PaError Pa_IsStreamStopped( PaStream *stream )
+PaError PA_API_CC Pa_IsStreamStopped( PaStream *stream )
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
@@ -1471,7 +1471,7 @@
 }
 
 
-PaError Pa_IsStreamActive( PaStream *stream )
+PaError PA_API_CC Pa_IsStreamActive( PaStream *stream )
 {
     PaError result = PaUtil_ValidateStreamPointer( stream );
 
@@ -1488,7 +1488,7 @@
 }
 
 
-const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream )
+const PaStreamInfo* PA_API_CC Pa_GetStreamInfo( PaStream *stream )
 {
     PaError error = PaUtil_ValidateStreamPointer( stream );
     const PaStreamInfo *result;
@@ -1524,7 +1524,7 @@
 }
 
 
-PaTime Pa_GetStreamTime( PaStream *stream )
+PaTime PA_API_CC Pa_GetStreamTime( PaStream *stream )
 {
     PaError error = PaUtil_ValidateStreamPointer( stream );
     PaTime result;
@@ -1553,7 +1553,7 @@
 }
 
 
-double Pa_GetStreamCpuLoad( PaStream* stream )
+double PA_API_CC Pa_GetStreamCpuLoad( PaStream* stream )
 {
     PaError error = PaUtil_ValidateStreamPointer( stream );
     double result;
@@ -1583,7 +1583,7 @@
 }
 
 
-PaError Pa_ReadStream( PaStream* stream,
+PaError PA_API_CC Pa_ReadStream( PaStream* stream,
                        void *buffer,
                        unsigned long frames )
 {
@@ -1623,7 +1623,7 @@
 }
 
 
-PaError Pa_WriteStream( PaStream* stream,
+PaError PA_API_CC Pa_WriteStream( PaStream* stream,
                         const void *buffer,
                         unsigned long frames )
 {
@@ -1662,7 +1662,7 @@
     return result;
 }
 
-signed long Pa_GetStreamReadAvailable( PaStream* stream )
+signed long PA_API_CC Pa_GetStreamReadAvailable( PaStream* stream )
 {
     PaError error = PaUtil_ValidateStreamPointer( stream );
     signed long result;
@@ -1691,7 +1691,7 @@
 }
 
 
-signed long Pa_GetStreamWriteAvailable( PaStream* stream )
+signed long PA_API_CC Pa_GetStreamWriteAvailable( PaStream* stream )
 {
     PaError error = PaUtil_ValidateStreamPointer( stream );
     signed long result;
@@ -1720,7 +1720,7 @@
 }
 
 
-PaError Pa_GetSampleSize( PaSampleFormat format )
+PaError PA_API_CC Pa_GetSampleSize( PaSampleFormat format )
 {
     int result;
 
Index: src/os/win/pa_win_util.c
===================================================================
--- src/os/win/pa_win_util.c	(revision 1304)
+++ src/os/win/pa_win_util.c	(working copy)
@@ -95,7 +95,7 @@
 }
 
 
-void Pa_Sleep( long msec )
+void PA_API_CC Pa_Sleep( long msec )
 {
     Sleep( msec );
 }
Index: src/os/win/pa_x86_plain_converters.c
===================================================================
--- src/os/win/pa_x86_plain_converters.c	(revision 1304)
+++ src/os/win/pa_x86_plain_converters.c	(working copy)
@@ -125,7 +125,7 @@
 #define PA_DITHER_BITS_   (15)
 /* Multiply by PA_FLOAT_DITHER_SCALE_ to get a float between -2.0 and +1.99999 */
 #define PA_FLOAT_DITHER_SCALE_  (1.0 / ((1<<PA_DITHER_BITS_)-1))
-static const float const_float_dither_scale_ = PA_FLOAT_DITHER_SCALE_;
+static const float const_float_dither_scale_ = (const float)PA_FLOAT_DITHER_SCALE_;
 #define PA_DITHER_SHIFT_  ((32 - PA_DITHER_BITS_) + 1)
 
 /* -------------------------------------------------------------------------- */
@@ -134,9 +134,9 @@
 
 /*
 	-EMT64/AMD64 uses different asm
-	-VC2005 doesnt allow _WIN64 with inline assembly either!
+	-VC2005 doesn't allow _WIN64 with inline assembly either!
  */
-void PaUtil_InitializeX86PlainConverters( void )
+void PA_API_CC PaUtil_InitializeX86PlainConverters( void )
 {
 }
 
@@ -1199,7 +1199,7 @@
 
 /* -------------------------------------------------------------------------- */
 
-void PaUtil_InitializeX86PlainConverters( void )
+void PA_API_CC PaUtil_InitializeX86PlainConverters( void )
 {
     paConverters.Float32_To_Int32 = Float32_To_Int32;
     paConverters.Float32_To_Int32_Clip = Float32_To_Int32_Clip;
Index: src/os/win/pa_x86_plain_converters.h
===================================================================
--- src/os/win/pa_x86_plain_converters.h	(revision 1304)
+++ src/os/win/pa_x86_plain_converters.h	(working copy)
@@ -40,6 +40,8 @@
 #ifndef PA_X86_PLAIN_CONVERTERS_H
 #define PA_X86_PLAIN_CONVERTERS_H
 
+#include "portaudio.h"		/* Required for PA_API_CC */
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -47,11 +49,11 @@
 
 
 /**
- @brief Install optimised converter functions suitable for all IA32 processors
+ @brief Install optimized converter functions suitable for all IA32 processors
 
  It is recommended to call PaUtil_InitializeX86PlainConverters prior to calling Pa_Initialize
 */
-void PaUtil_InitializeX86PlainConverters( void );
+void PA_API_CC PaUtil_InitializeX86PlainConverters( void );
 
 
 #ifdef __cplusplus
