Merge branch 'master' into windows
[ardour.git] / libs / rubberband / rubberband / msvc_rubberband.h
1 /*
2     Copyright (C) 2009 John Emmas
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19 #ifndef __msvc_rubberband_h__
20 #define __msvc_rubberband_h__
21
22 #ifdef  RUBBERBAND_IS_IN_WIN_STATIC_LIB  // #define if your project uses librubberband (under Windows) as a static library
23 #define RUBBERBAND_IS_IN_WINDLL 0
24 #endif
25
26 #if !defined(RUBBERBAND_IS_IN_WINDLL)
27         #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
28         // If you need '__declspec' compatibility, add extra compilers to the above as necessary
29                 #define RUBBERBAND_IS_IN_WINDLL 1
30         #else
31                 #define RUBBERBAND_IS_IN_WINDLL 0
32         #endif
33 #endif
34
35 #if RUBBERBAND_IS_IN_WINDLL && !defined(RUBBERBAND_API)
36         #if defined(BUILDING_RUBBERBAND)
37                 #define RUBBERBAND_API __declspec(dllexport)
38                 #define RUBBERBAND_APICALLTYPE __stdcall
39         #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
40                 #define RUBBERBAND_API __declspec(dllimport)
41                 #define RUBBERBAND_APICALLTYPE __stdcall
42         #else
43                 #error "Attempting to define __declspec with an incompatible compiler !"
44         #endif
45 #elif !defined(RUBBERBAND_API)
46         // Other compilers / platforms could be accommodated here
47         #define RUBBERBAND_API
48         #define RUBBERBAND_APICALLTYPE
49         #define GETOPT_API
50         #define GETOPT_APICALLTYPE
51 #endif
52
53 #ifndef GETOPT_API
54         #if defined(BUILDING_GETOPT)
55                 #define GETOPT_API __declspec(dllexport)
56                 #define GETOPT_APICALLTYPE __cdecl
57         #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
58                 #define GETOPT_API __declspec(dllimport)
59                 #define GETOPT_APICALLTYPE __cdecl
60         #else
61                 #error "Attempting to define __declspec with an incompatible compiler !"
62         #endif
63 #endif  // GETOPT_API
64
65 #ifdef COMPILER_MSVC
66 #include <rpc.h>
67
68 #ifndef __THROW
69 #define __THROW throw()
70 #endif
71
72 namespace RubberBand {
73
74 #ifdef __cplusplus
75 extern "C" {
76 #endif  /* __cplusplus */
77
78 // These are used to replicate 'dirent.h' functionality
79 // RUBBERBAND_API int RUBBERBAND_APICALLTYPE placeholder();
80
81 #ifdef __cplusplus
82 }               /* extern "C" */
83 #endif  /* __cplusplus */
84
85 }  // namespace Rubberband
86
87 #endif  //      COMPILER_MSVC
88 #endif  // __msvc_rubberband_h__