1/*
2 * Copyright 2022 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkAPI_DEFINED
9#define SkAPI_DEFINED
10
11#include "include/private/base/SkLoadUserConfig.h" // IWYU pragma: keep
12
13// If SKIA_IMPLEMENTATION is defined as 1, that signals we are building Skia and should
14// export our symbols. If it is not set (or set to 0), then Skia is being used by a client
15// and we should not export our symbols.
16#if !defined(SKIA_IMPLEMENTATION)
17 #define SKIA_IMPLEMENTATION 0
18#endif
19
20// If we are compiling Skia is being as a DLL, we need to be sure to export all of our public
21// APIs to that DLL. If a client is using Skia which was compiled as a DLL, we need to instruct
22// the linker to use the symbols from that DLL. This is the goal of the SK_API define.
23#if !defined(SK_API)
24 #if defined(SKIA_DLL)
25 #if defined(_MSC_VER)
26 #if SKIA_IMPLEMENTATION
27 #define SK_API __declspec(dllexport)
28 #else
29 #define SK_API __declspec(dllimport)
30 #endif
31 #else
32 #define SK_API __attribute__((visibility("default")))
33 #endif
34 #else
35 #define SK_API
36 #endif
37#endif
38
39// SK_SPI is functionally identical to SK_API, but used within src to clarify that it's less stable
40#if !defined(SK_SPI)
41 #define SK_SPI SK_API
42#endif
43
44// See https://clang.llvm.org/docs/AttributeReference.html#availability
45// The API_AVAILABLE macro comes from <os/availability.h> on MacOS
46#if defined(SK_ENABLE_API_AVAILABLE)
47# define SK_API_AVAILABLE API_AVAILABLE
48#else
49# define SK_API_AVAILABLE(...)
50#endif
51
52#endif
53

source code of flutter_engine/third_party/skia/include/private/base/SkAPI.h