1 /** 2 * @file extern.h 3 * @brief Definitions of LIBSBML_EXTERN and related things. 4 * @author Ben Bornstein 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSBML. Please visit http://sbml.org for more 8 * information about SBML, and the latest version of libSBML. 9 * 10 * Copyright (C) 2020 jointly by the following organizations: 11 * 1. California Institute of Technology, Pasadena, CA, USA 12 * 2. University of Heidelberg, Heidelberg, Germany 13 * 3. University College London, London, UK 14 * 15 * Copyright (C) 2019 jointly by the following organizations: 16 * 1. California Institute of Technology, Pasadena, CA, USA 17 * 2. University of Heidelberg, Heidelberg, Germany 18 * 19 * Copyright (C) 2013-2018 jointly by the following organizations: 20 * 1. California Institute of Technology, Pasadena, CA, USA 21 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 22 * 3. University of Heidelberg, Heidelberg, Germany 23 * 24 * Copyright (C) 2009-2013 jointly by the following organizations: 25 * 1. California Institute of Technology, Pasadena, CA, USA 26 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 27 * 28 * Copyright (C) 2006-2008 by the California Institute of Technology, 29 * Pasadena, CA, USA 30 * 31 * Copyright (C) 2002-2005 jointly by the following organizations: 32 * 1. California Institute of Technology, Pasadena, CA, USA 33 * 2. Japan Science and Technology Agency, Japan 34 * 35 * This library is free software; you can redistribute it and/or modify it 36 * under the terms of the GNU Lesser General Public License as published by 37 * the Free Software Foundation. A copy of the license agreement is provided 38 * in the file named "LICENSE.txt" included with this software distribution and 39 * also available online as http://sbml.org/software/libsbml/license.html 40 * ---------------------------------------------------------------------- -->*/ 41 42 #ifndef LIBSBML_EXTERN_H 43 #define LIBSBML_EXTERN_H 44 45 #include <sbml/common/libsbml-namespace.h> 46 47 #if ( defined(WIN32) && !defined(CYGWIN) && !defined(__MINGW32__)) 48 49 #if ( ! defined LIBSBML_STATIC ) 50 /** 51 * The following ifdef block is the standard way of creating macros which 52 * make exporting from a DLL simpler. All files within this DLL are 53 * compiled with the LIBSBML_EXPORTS symbol defined on the command line. 54 * This symbol should not be defined on any project that uses this 55 * DLL. This way any other project whose source files include this file see 56 * LIBSBML_EXTERN functions as being imported from a DLL, wheras this DLL 57 * sees symbols defined with this macro as being exported. 58 * 59 * (From Andrew Finney's sbwdefs.h, with "SBW" replaced by "LIBSBML" :) 60 */ 61 #if defined(LIBSBML_EXPORTS) 62 # define LIBSBML_EXTERN __declspec(dllexport) 63 #else 64 # define LIBSBML_EXTERN __declspec(dllimport) 65 #endif 66 67 #else 68 # define LIBSBML_EXTERN 69 #endif /* LIBSBML_STATIC */ 70 71 /** 72 * Disable MSVC++ warning C4800: 'const int' : forcing value to bool 'true' 73 * or 'false' (performance warning). 74 */ 75 #pragma warning(disable: 4800) 76 77 /** 78 * Disable MSVC++ warning C4291: no matching operator delete found. 79 */ 80 #pragma warning(disable: 4291) 81 82 /** 83 * Disable MSVC++ warning C4251: class 'type' needs to have dll-interface 84 * to be used by clients of class 'type2'. 85 * 86 * For an explanation of why this is safe, see: 87 * - http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html 88 */ 89 #pragma warning(disable: 4251) 90 #pragma warning(disable: 4275) 91 92 #else 93 94 /** 95 * LIBSBML_EXTERN is used under Windows to simplify exporting functions 96 * from a DLL. When compiling under Windows, all files within this DLL are 97 * compiled with the LIBSBML_EXPORTS symbol defined on the command line. 98 * This in turn causes extern.h to define a different version of 99 * LIBSBML_EXTERN that is appropriate for exporting functions to client 100 * code that uses the DLL. 101 */ 102 #define LIBSBML_EXTERN 103 104 #endif /* WIN32 */ 105 106 #undef BEGIN_C_DECLS 107 #undef END_C_DECLS 108 109 #if defined(__cplusplus) 110 # define BEGIN_C_DECLS extern "C" { 111 # define END_C_DECLS } 112 #else 113 # define BEGIN_C_DECLS 114 # define END_C_DECLS 115 #endif 116 117 118 #endif /** LIBSBML_EXTERN_H **/ 119 120