libxtc
0.4.0
Async concurrency for C: Tokio + Seastar + BEAM, in one library
Loading...
Searching...
No Matches
xtc_export.h
1
/*-
2
* Copyright (c) 2026, The XTC Project
3
* Use of this source code is governed by the ISC License,
4
* a copy of which is in the file LICENSE in the top-level directory
5
* of this distribution.
6
*
7
* src/inc/xtc_export.h
8
* Cross-platform shared-library symbol export/import macro.
9
*
10
* MSVC does not export ANY symbol from a DLL by default (unlike
11
* gcc/clang, which export everything from a .so unless told
12
* otherwise); every function meant to be callable from outside
13
* the DLL needs an explicit __declspec(dllexport) on the
14
* declaration seen while COMPILING the library, and
15
* __declspec(dllimport) on the declaration seen while COMPILING
16
* a CONSUMER that links against the DLL. XTC_API expands to the
17
* right one of those, or to nothing at all everywhere else:
18
*
19
* - XTC_BUILDING_DLL defined (set by the library's own build
20
* when compiling a Windows shared/DLL target): dllexport.
21
* - XTC_DLL defined, XTC_BUILDING_DLL NOT defined (a consumer
22
* that has opted into "I am linking against xtc as a DLL"):
23
* dllimport.
24
* - Anywhere else -- non-Windows (gcc/clang .so, static libs on
25
* every platform, or a Windows consumer of the static
26
* xtc.lib that never defines XTC_DLL): nothing. This is the
27
* common case and MUST be a complete no-op there.
28
*
29
* A consumer building against the shared xtc.dll on Windows adds
30
* -DXTC_DLL to its own compile flags; everyone else needs no
31
* flag at all.
32
*/
33
34
#ifndef XTC_EXPORT_H
35
#define XTC_EXPORT_H
36
37
#if defined(_WIN32) && defined(XTC_BUILDING_DLL)
38
# define XTC_API __declspec(dllexport)
39
#elif defined(_WIN32) && defined(XTC_DLL)
40
# define XTC_API __declspec(dllimport)
41
#else
42
# define XTC_API
43
#endif
44
45
#endif
/* XTC_EXPORT_H */
src
inc
xtc_export.h
Generated by
1.9.8