Jack2: weakmacros.h Source File

Jack2 1.9.21

weakmacros.h
1/*
2 Copyright (C) 2010 Paul Davis
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18*/
19
20#ifndef __weakmacros_h__
21#define __weakmacros_h__
22
23/*************************************************************
24 * NOTE: JACK_WEAK_EXPORT ***MUST*** be used on every function
25 * added to the JACK API after the 0.116.2 release.
26 *
27 * Functions that predate this release are marked with
28 * JACK_WEAK_OPTIONAL_EXPORT which can be defined at compile
29 * time in a variety of ways. The default definition is empty,
30 * so that these symbols get normal linkage. If you wish to
31 * use all JACK symbols with weak linkage, include
32 * <jack/weakjack.h> before jack.h.
33 *************************************************************/
34
35#ifdef __APPLE__
36#define WEAK_ATTRIBUTE weak_import
37#else
38#define WEAK_ATTRIBUTE __weak__
39#endif
40
41#ifndef JACK_WEAK_EXPORT
42#ifdef __GNUC__
43/* JACK_WEAK_EXPORT needs to be a macro which
44 expands into a compiler directive. If non-null, the directive
45 must tell the compiler to arrange for weak linkage of
46 the symbol it used with. For this to work full may
47 require linker arguments in the client as well.
48*/
49
50#ifdef _WIN32
51 /*
52 Not working with __declspec(dllexport) so normal linking
53 Linking with JackWeakAPI.cpp will be the preferred way.
54 */
55 #define JACK_WEAK_EXPORT
56#else
57 #define JACK_WEAK_EXPORT __attribute__((WEAK_ATTRIBUTE))
58#endif
59
60#else
61/* Add other things here for non-gcc platforms */
62
63#ifdef _WIN32
64#define JACK_WEAK_EXPORT
65#endif
66
67#endif
68#endif
69
70#ifndef JACK_WEAK_EXPORT
71#define JACK_WEAK_EXPORT
72#endif
73
74#ifndef JACK_OPTIONAL_WEAK_EXPORT
75#define JACK_OPTIONAL_WEAK_EXPORT
76#endif
77
78#ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
79#ifdef __GNUC__
80#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT __attribute__((__deprecated__))
81#else
82/* Add other things here for non-gcc platforms */
83
84#ifdef _WIN32
85#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
86#endif
87
88#endif /* __GNUC__ */
89
90#ifndef JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
91#define JACK_OPTIONAL_WEAK_DEPRECATED_EXPORT
92#endif
93
94#endif
95
96#endif /* __weakmacros_h__ */
97