incomplete merge of master into windows (requires upcoming changes to master to be...
[ardour.git] / libs / ardour / ardour / msvc_libardour.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_libardour_h__
20 #define __msvc_libardour_h__
21
22 #include <limits.h>
23
24 #ifdef  LIBARDOUR_IS_IN_WIN_STATIC_LIB  // #define if your project uses libardour (under Windows) as a static library
25 #define LIBARDOUR_IS_IN_WINDLL 0
26 #endif
27
28 #if !defined(LIBARDOUR_IS_IN_WINDLL)
29         #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
30         // If you need '__declspec' compatibility, add extra compilers to the above as necessary
31                 #define LIBARDOUR_IS_IN_WINDLL 1
32         #else
33                 #define LIBARDOUR_IS_IN_WINDLL 0
34         #endif
35 #endif
36
37 #if LIBARDOUR_IS_IN_WINDLL && !defined(LIBARDOUR_API)
38         #if defined(BUILDING_LIBARDOUR)
39                 #define LIBARDOUR_API __declspec(dllexport)
40                 #define LIBARDOUR_APICALLTYPE __stdcall
41         #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
42                 #define LIBARDOUR_API __declspec(dllimport)
43                 #define LIBARDOUR_APICALLTYPE __stdcall
44         #else
45                 #error "Attempting to define __declspec with an incompatible compiler !"
46         #endif
47 #elif !defined(LIBARDOUR_API)
48         // Other compilers / platforms could be accommodated here
49         #define LIBARDOUR_API
50         #define LIBARDOUR_APICALLTYPE
51 #endif
52
53 #ifndef _MAX_PATH
54 #define _MAX_PATH  260
55 #endif
56 #ifndef  PATH_MAX
57 #define  PATH_MAX _MAX_PATH
58 #endif
59
60 namespace ARDOUR {
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif  /* __cplusplus */
65
66 // LIBARDOUR_API char*  LIBARDOUR_APICALLTYPE placeholder_for_non_msvc_specific_function(s);
67
68 #ifdef __cplusplus
69 }               /* extern "C" */
70 #endif  /* __cplusplus */
71
72 }  // namespace ARDOUR
73
74 #ifdef COMPILER_MSVC
75 #include <rpc.h>
76 //#include <io.h>
77
78 #ifndef __THROW
79 #define __THROW throw()
80 #endif
81 #include <ardourext/sys/time.h>
82
83 namespace ARDOUR {
84
85 #ifdef __cplusplus
86 extern "C" {
87 #endif  /* __cplusplus */
88
89 LIBARDOUR_API int    LIBARDOUR_APICALLTYPE symlink(const char *dest, const char *shortcut, const char *working_directory = 0);
90 LIBARDOUR_API int    LIBARDOUR_APICALLTYPE readlink(const char *__restrict shortcut, char *__restrict buf, size_t bufsize);
91
92 #ifdef __cplusplus
93 }               /* extern "C" */
94 #endif  /* __cplusplus */
95
96 }  // namespace ARDOUR
97
98 #endif  //      COMPILER_MSVC
99 #endif  // __mavc_libardour_h__