xref: /freebsd/contrib/libevent/include/event2/visibility.h (revision b50261e21f39a6c7249a49e7b60aa878c98512a8)
1c43e99fdSEd Maste /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2c43e99fdSEd Maste /*
3c43e99fdSEd Maste  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4c43e99fdSEd Maste  *
5c43e99fdSEd Maste  * Redistribution and use in source and binary forms, with or without
6c43e99fdSEd Maste  * modification, are permitted provided that the following conditions
7c43e99fdSEd Maste  * are met:
8c43e99fdSEd Maste  * 1. Redistributions of source code must retain the above copyright
9c43e99fdSEd Maste  *    notice, this list of conditions and the following disclaimer.
10c43e99fdSEd Maste  * 2. Redistributions in binary form must reproduce the above copyright
11c43e99fdSEd Maste  *    notice, this list of conditions and the following disclaimer in the
12c43e99fdSEd Maste  *    documentation and/or other materials provided with the distribution.
13c43e99fdSEd Maste  * 3. The name of the author may not be used to endorse or promote products
14c43e99fdSEd Maste  *    derived from this software without specific prior written permission.
15c43e99fdSEd Maste  *
16c43e99fdSEd Maste  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17c43e99fdSEd Maste  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18c43e99fdSEd Maste  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19c43e99fdSEd Maste  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20c43e99fdSEd Maste  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21c43e99fdSEd Maste  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22c43e99fdSEd Maste  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23c43e99fdSEd Maste  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24c43e99fdSEd Maste  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25c43e99fdSEd Maste  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26c43e99fdSEd Maste  */
27c43e99fdSEd Maste #ifndef EVENT2_VISIBILITY_H_INCLUDED_
28c43e99fdSEd Maste #define EVENT2_VISIBILITY_H_INCLUDED_
29c43e99fdSEd Maste 
30c43e99fdSEd Maste #include <event2/event-config.h>
31c43e99fdSEd Maste 
32*b50261e2SCy Schubert #if defined(event_shared_EXPORTS) || \
33*b50261e2SCy Schubert     defined(event_extra_shared_EXPORTS) || \
34*b50261e2SCy Schubert     defined(event_core_shared_EXPORTS) || \
35*b50261e2SCy Schubert     defined(event_pthreads_shared_EXPORTS) || \
36*b50261e2SCy Schubert     defined(event_openssl_shared_EXPORTS)
37*b50261e2SCy Schubert 
38c43e99fdSEd Maste # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
39c43e99fdSEd Maste #  define EVENT2_EXPORT_SYMBOL __global
40c43e99fdSEd Maste # elif defined __GNUC__
41c43e99fdSEd Maste #  define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
42c43e99fdSEd Maste # elif defined(_MSC_VER)
43*b50261e2SCy Schubert #  define EVENT2_EXPORT_SYMBOL __declspec(dllexport)
44c43e99fdSEd Maste # else
45c43e99fdSEd Maste #  define EVENT2_EXPORT_SYMBOL /* unknown compiler */
46c43e99fdSEd Maste # endif
47*b50261e2SCy Schubert 
48*b50261e2SCy Schubert #else /* event_*_EXPORTS */
49*b50261e2SCy Schubert 
50c43e99fdSEd Maste # define EVENT2_EXPORT_SYMBOL
51*b50261e2SCy Schubert 
52*b50261e2SCy Schubert #endif /* event_*_EXPORTS */
53*b50261e2SCy Schubert 
54*b50261e2SCy Schubert /** We need to dllimport event_debug_logging_mask_ into event_extra */
55*b50261e2SCy Schubert #if defined(_MSC_VER)
56*b50261e2SCy Schubert # if defined(event_core_shared_EXPORTS) /** from core export */
57*b50261e2SCy Schubert #  define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllexport)
58*b50261e2SCy Schubert # elif defined(event_extra_shared_EXPORTS) || /** from extra import */ \
59*b50261e2SCy Schubert        defined(EVENT_VISIBILITY_WANT_DLLIMPORT)
60*b50261e2SCy Schubert #  define EVENT2_CORE_EXPORT_SYMBOL __declspec(dllimport)
61c43e99fdSEd Maste # endif
62*b50261e2SCy Schubert #endif /* _MSC_VER */
63*b50261e2SCy Schubert #if !defined(EVENT2_CORE_EXPORT_SYMBOL)
64*b50261e2SCy Schubert # define EVENT2_CORE_EXPORT_SYMBOL EVENT2_EXPORT_SYMBOL
65c43e99fdSEd Maste #endif
66c43e99fdSEd Maste 
67c43e99fdSEd Maste #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
68