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 // When building for Chrome a part of the code can be built into 31 // a shared library, which is controlled by these macros. 32 // For all other builds, we always build a static library. 33 #if !defined(GOOGLE_CHROME_BUILD) && !defined(CHROMIUM_BUILD) 34 #define LIBPEERCONNECTION_LIB 1 35 #endif 36 37 #ifndef NON_EXPORTED_BASE 38 #ifdef WIN32 39 40 // MSVC_SUPPRESS_WARNING disables warning |n| for the remainder of the line and 41 // for the next line of the source file. 42 #define MSVC_SUPPRESS_WARNING(n) __pragma(warning(suppress:n)) 43 44 // Allows exporting a class that inherits from a non-exported base class. 45 // This uses suppress instead of push/pop because the delimiter after the 46 // declaration (either "," or "{") has to be placed before the pop macro. 47 // 48 // Example usage: 49 // class EXPORT_API Foo : NON_EXPORTED_BASE(public Bar) { 50 // 51 // MSVC Compiler warning C4275: 52 // non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. 53 // Note that this is intended to be used only when no access to the base class' 54 // static data is done through derived classes or inline methods. For more info, 55 // see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx 56 #define NON_EXPORTED_BASE(code) MSVC_SUPPRESS_WARNING(4275) \ 57 code 58 59 #else // Not WIN32 60 #define NON_EXPORTED_BASE(code) code 61 #endif // WIN32 62 #endif // NON_EXPORTED_BASE 63 64 #if defined (LIBPEERCONNECTION_LIB) 65 #define WRME_EXPORT 66 #else 67 #if defined(WIN32) 68 #if defined(LIBPEERCONNECTION_IMPLEMENTATION) 69 #define WRME_EXPORT __declspec(dllexport) 70 #else 71 #define WRME_EXPORT __declspec(dllimport) 72 #endif 73 #else // defined(WIN32) 74 #if defined(LIBPEERCONNECTION_IMPLEMENTATION) 75 #define WRME_EXPORT __attribute__((visibility("default"))) 76 #else 77 #define WRME_EXPORT 78 #endif 79 #endif 80 #endif // LIBPEERCONNECTION_LIB 81 82 #endif // TALK_MEDIA_WEBRTC_WEBRTCEXPORT_H_ 83