• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * libjingle
3  * Copyright 2004--2013, Google Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  *  1. Redistributions of source code must retain the above copyright notice,
9  *     this list of conditions and the following disclaimer.
10  *  2. Redistributions in binary form must reproduce the above copyright notice,
11  *     this list of conditions and the following disclaimer in the documentation
12  *     and/or other materials provided with the distribution.
13  *  3. The name of the author may not be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef TALK_MEDIA_WEBRTC_WEBRTCEXPORT_H_
28 #define TALK_MEDIA_WEBRTC_WEBRTCEXPORT_H_
29 
30 #if !defined(GOOGLE_CHROME_BUILD) && !defined(CHROMIUM_BUILD)
31 #define LIBPEERCONNECTION_LIB 1
32 #endif
33 
34 #ifndef NON_EXPORTED_BASE
35 #ifdef WIN32
36 
37 // MSVC_SUPPRESS_WARNING disables warning |n| for the remainder of the line and
38 // for the next line of the source file.
39 #define MSVC_SUPPRESS_WARNING(n) __pragma(warning(suppress:n))
40 
41 // Allows exporting a class that inherits from a non-exported base class.
42 // This uses suppress instead of push/pop because the delimiter after the
43 // declaration (either "," or "{") has to be placed before the pop macro.
44 //
45 // Example usage:
46 // class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) {
47 //
48 // MSVC Compiler warning C4275:
49 // non dll-interface class 'Bar' used as base for dll-interface class 'Foo'.
50 // Note that this is intended to be used only when no access to the base class'
51 // static data is done through derived classes or inline methods. For more info,
52 // see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
53 #define NON_EXPORTED_BASE(code) MSVC_SUPPRESS_WARNING(4275) \
54                                 code
55 
56 #else  // Not WIN32
57 #define NON_EXPORTED_BASE(code) code
58 #endif  // WIN32
59 #endif  // NON_EXPORTED_BASE
60 
61 #if defined (LIBPEERCONNECTION_LIB)
62   #define WRME_EXPORT
63 #else
64   #if defined(WIN32)
65     #if defined(LIBPEERCONNECTION_IMPLEMENTATION)
66       #define WRME_EXPORT __declspec(dllexport)
67     #else
68       #define WRME_EXPORT __declspec(dllimport)
69     #endif
70   #else // defined(WIN32)
71     #if defined(LIBPEERCONNECTION_IMPLEMENTATION)
72       #define WRME_EXPORT __attribute__((visibility("default")))
73     #else
74       #define WRME_EXPORT
75     #endif
76   #endif
77 #endif  // LIBPEERCONNECTION_LIB
78 
79 #endif  // TALK_MEDIA_WEBRTC_WEBRTCEXPORT_H_
80