xref: /freebsd/contrib/ntp/sntp/libevent/include/event2/visibility.h (revision a466cc55373fc3cf86837f09da729535b57e69a1)
12b15cb3dSCy Schubert /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
22b15cb3dSCy Schubert /*
32b15cb3dSCy Schubert  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
42b15cb3dSCy Schubert  *
52b15cb3dSCy Schubert  * Redistribution and use in source and binary forms, with or without
62b15cb3dSCy Schubert  * modification, are permitted provided that the following conditions
72b15cb3dSCy Schubert  * are met:
82b15cb3dSCy Schubert  * 1. Redistributions of source code must retain the above copyright
92b15cb3dSCy Schubert  *    notice, this list of conditions and the following disclaimer.
102b15cb3dSCy Schubert  * 2. Redistributions in binary form must reproduce the above copyright
112b15cb3dSCy Schubert  *    notice, this list of conditions and the following disclaimer in the
122b15cb3dSCy Schubert  *    documentation and/or other materials provided with the distribution.
132b15cb3dSCy Schubert  * 3. The name of the author may not be used to endorse or promote products
142b15cb3dSCy Schubert  *    derived from this software without specific prior written permission.
152b15cb3dSCy Schubert  *
162b15cb3dSCy Schubert  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
172b15cb3dSCy Schubert  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
182b15cb3dSCy Schubert  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
192b15cb3dSCy Schubert  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
202b15cb3dSCy Schubert  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
212b15cb3dSCy Schubert  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222b15cb3dSCy Schubert  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232b15cb3dSCy Schubert  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242b15cb3dSCy Schubert  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
252b15cb3dSCy Schubert  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262b15cb3dSCy Schubert  */
272b15cb3dSCy Schubert #ifndef EVENT2_VISIBILITY_H_INCLUDED_
282b15cb3dSCy Schubert #define EVENT2_VISIBILITY_H_INCLUDED_
292b15cb3dSCy Schubert 
302b15cb3dSCy Schubert #include <event2/event-config.h>
312b15cb3dSCy Schubert 
32*a466cc55SCy Schubert #if defined(event_shared_EXPORTS) || \
33*a466cc55SCy Schubert     defined(event_extra_shared_EXPORTS) || \
34*a466cc55SCy Schubert     defined(event_core_shared_EXPORTS) || \
35*a466cc55SCy Schubert     defined(event_pthreads_shared_EXPORTS) || \
36*a466cc55SCy Schubert     defined(event_openssl_shared_EXPORTS)
372b15cb3dSCy Schubert 
382b15cb3dSCy Schubert # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
392b15cb3dSCy Schubert #  define EVENT2_EXPORT_SYMBOL __global
402b15cb3dSCy Schubert # elif defined __GNUC__
412b15cb3dSCy Schubert #  define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
422b15cb3dSCy Schubert # elif defined(_MSC_VER)
43*a466cc55SCy Schubert #  define EVENT2_EXPORT_SYMBOL __declspec(dllexport)
442b15cb3dSCy Schubert # else
45*a466cc55SCy Schubert #  define EVENT2_EXPORT_SYMBOL /* unknown compiler */
462b15cb3dSCy Schubert # endif
472b15cb3dSCy Schubert 
48*a466cc55SCy Schubert #else /* event_*_EXPORTS */
492b15cb3dSCy Schubert 
502b15cb3dSCy Schubert # define EVENT2_EXPORT_SYMBOL
512b15cb3dSCy Schubert 
52*a466cc55SCy Schubert #endif /* event_*_EXPORTS */
53*a466cc55SCy Schubert 
54*a466cc55SCy Schubert /** We need to dllimport event_debug_logging_mask_ into event_extra */
55*a466cc55SCy Schubert #if defined(_MSC_VER)
56*a466cc55SCy Schubert # if defined(event_core_shared_EXPORTS) /** from core export */
57*a466cc55SCy Schubert #  define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllexport)
58*a466cc55SCy Schubert # elif defined(event_extra_shared_EXPORTS) || /** from extra import */ \
59*a466cc55SCy Schubert        defined(EVENT_VISIBILITY_WANT_DLLIMPORT)
60*a466cc55SCy Schubert #  define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllimport)
61*a466cc55SCy Schubert # endif
62*a466cc55SCy Schubert #endif /* _MSC_VER */
63*a466cc55SCy Schubert #if !defined(EVENT2_CORE_EXPORT_SYMBOL)
64*a466cc55SCy Schubert # define EVENT2_CORE_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
652b15cb3dSCy Schubert #endif
662b15cb3dSCy Schubert 
672b15cb3dSCy Schubert #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
68