2 Copyright (C) 2009 John Emmas
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.
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.
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.
22 #ifdef PBD_IS_IN_WIN_STATIC_LIB // #define if your project uses libpbd (under Windows) as a static library
24 #define PBD_IS_IN_WINDLL 0
27 #include <pbd/libpbd_visibility.h>
32 #include <ardourext/misc.h>
33 #include <ardourext/sys/time.h>
36 #if !defined(PBD_IS_IN_WINDLL)
37 #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
38 // If you need '__declspec' compatibility, add extra compilers to the above as necessary
39 #define PBD_IS_IN_WINDLL 1
41 #define PBD_IS_IN_WINDLL 0
45 #if PBD_IS_IN_WINDLL && !defined(PBD_APICALLTYPE)
46 #if defined(BUILDING_PBD)
47 #define PBD_APICALLTYPE __cdecl
48 #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
49 #define PBD_APICALLTYPE __cdecl
51 #error "Attempting to define __declspec with an incompatible compiler !"
53 #elif !defined(PBD_APICALLTYPE)
54 // Other compilers / platforms could be accommodated here
55 #define PBD_APICALLTYPE
58 #define GETOPT_APICALLTYPE
63 #if defined(BUILDING_GETOPT)
64 #define GETOPT_API __declspec(dllexport)
65 #define GETOPT_APICALLTYPE __cdecl
66 #elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MINGW32__)
67 #define GETOPT_API __declspec(dllimport)
68 #define GETOPT_APICALLTYPE __cdecl
70 #error "Attempting to define __declspec with an incompatible compiler !"
78 #define PATH_MAX _MAX_PATH
83 #endif /* __cplusplus */
87 #endif /* __cplusplus */
89 #ifdef PLATFORM_WINDOWS
92 #if defined(BUILDING_PBDEXTN)
93 #define PBDEXTN_API __declspec(dllexport)
94 #define PBDEXTN_APICALLTYPE __cdecl
95 #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
96 #define PBDEXTN_API __declspec(dllimport)
97 #define PBDEXTN_APICALLTYPE __cdecl
99 #error "Attempting to define __declspec with an incompatible compiler !"
101 #endif // PBDEXTN_API
103 #ifndef CYGIMPORT_API
104 #define CYGIMPORT_API __declspec(dllimport)
105 #define CYGIMPORT_APICALLTYPE __cdecl
106 #endif // CYGIMPORT_API
109 #define __THROW throw()
113 #define RTLD_DEFAULT ((void *) 0)
114 #define RTLD_NEXT ((void *) -1L)
115 #define RTLD_LAZY 0x00001
116 #define RTLD_NOW 0x00002
117 #define RTLD_BINDING_MASK 0x00003
118 #define RTLD_NOLOAD 0x00004
119 #define RTLD_GLOBAL 0x00004
120 #define RTLD_DEEPBIND 0x00008
129 #endif /* __cplusplus */
131 PBDEXTN_API int PBDEXTN_APICALLTYPE cyginit (unsigned int result);
132 LIBPBD_API int PBD_APICALLTYPE dlclose (void *handle) __THROW;
133 LIBPBD_API void* PBD_APICALLTYPE dlopen (const char *file_name, int mode) __THROW;
134 LIBPBD_API void* PBD_APICALLTYPE dlsym (void *handle, const char *symbol_name) __THROW;
135 LIBPBD_API char* PBD_APICALLTYPE dlerror () __THROW;
139 #endif /* __cplusplus */
142 /* For whatever reason, Ardour's 'libevoral' refuses to build as a DLL if we include both 'rpc.h' */
143 /* and 'WinSock2.h'. It doesn't seem to matter which order we #include them. Given that we can't */
144 /* edit 'rpc.h' or 'WinSock2.h', just make sure we don't #include them when building libevoral. */
145 #if !defined(BUILDING_EVORAL) && !defined(BUILDING_QMDSP) && !defined(BUILDING_VAMPPLUGINS)
147 typedef int (FAR PBDEXTN_APICALLTYPE *CYGINIT_API)(unsigned int);
150 #include <sys/types.h>
153 #define FILENAME_MAX (260)
158 typedef long _ssize_t;
161 typedef _ssize_t ssize_t;
163 #endif /* ! _SSIZE_T_ */
167 long d_ino; // Always zero
168 unsigned short d_reclen; // Always zero
169 unsigned short d_namlen; // Length of name in d_name
170 char d_name[FILENAME_MAX]; // File name
173 // This is an internal data structure. Do not use it
174 // except as an argument to one of the functions below.
177 // Disk transfer area for this dir
178 struct _finddata_t dd_dta;
180 // 'dirent' struct to return from dir (NOTE: this
181 // is not thread safe).
182 struct dirent dd_dir;
184 // '_findnext()' handle
187 // Current status of search:
188 // 0 = not started yet (next entry to read is first entry)
190 // Otherwise - positive (0 based) index of next entry
193 // Full path for dir with search pattern (struct will be extended)
197 typedef unsigned int nfds_t;
201 #endif /* __cplusplus */
203 LIBPBD_API int __cdecl gettimeofday(struct timeval *__restrict tv, __timezone_ptr_t tz);
204 LIBPBD_API ssize_t PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes, off_t offset);
205 LIBPBD_API ssize_t PBD_APICALLTYPE pwrite(int handle, const void *buf, size_t nbytes, off_t offset);
207 #if defined(_MSC_VER) && (_MSC_VER < 1800)
208 LIBPBD_API double PBD_APICALLTYPE expm1(double x);
209 LIBPBD_API double PBD_APICALLTYPE log1p(double x);
210 LIBPBD_API double PBD_APICALLTYPE round(double x);
211 LIBPBD_API float PBD_APICALLTYPE roundf(float x);
214 #if defined(_MSC_VER) && (_MSC_VER < 1900)
215 LIBPBD_API double PBD_APICALLTYPE log2 (double x);
216 LIBPBD_API double PBD_APICALLTYPE trunc(double x);
221 LIBPBD_API bool PBD_APICALLTYPE TestForMinimumSpecOS(char *revision="currently ignored");
222 LIBPBD_API char* PBD_APICALLTYPE realpath (const char *original_path, char resolved_path[_MAX_PATH+1]);
223 LIBPBD_API int PBD_APICALLTYPE mkstemp (char *template_name);
224 LIBPBD_API int PBD_APICALLTYPE ntfs_link (const char *existing_filepath, const char *link_filepath);
225 LIBPBD_API int PBD_APICALLTYPE ntfs_unlink (const char *link_filepath);
227 // These are used to replicate 'dirent.h' functionality
228 LIBPBD_API DIR* PBD_APICALLTYPE opendir (const char *szPath);
229 LIBPBD_API struct dirent* PBD_APICALLTYPE readdir (DIR *pDir);
230 LIBPBD_API int PBD_APICALLTYPE closedir (DIR *pDir);
236 #endif /* __cplusplus */
238 #endif // !__CYGWIN__
239 #endif // PLATFORM_WINDOWS
240 #endif // _msvc_pbd_h_