LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
export.h
1/*
2 * Copyright 2026 LiveKit
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19// LIVEKIT_API marks a symbol as part of the public ABI of liblivekit.
20//
21// On Unix, the SDK is built with -fvisibility=hidden / -fvisibility-inlines-hidden,
22// so every symbol defaults to hidden. LIVEKIT_API re-exposes the symbol with
23// default visibility. Consumers see no annotation (just a normal declaration).
24//
25// On Windows, the SDK is built without WINDOWS_EXPORT_ALL_SYMBOLS, so symbols
26// must be explicitly tagged with __declspec(dllexport) when building the SDK
27// and __declspec(dllimport) when consuming it. LIVEKIT_BUILDING_SDK is defined
28// only when compiling the SDK itself (set in CMakeLists.txt).
29
30#if defined(_WIN32)
31#if defined(LIVEKIT_BUILDING_SDK)
32#define LIVEKIT_API __declspec(dllexport)
33#else
34#define LIVEKIT_API __declspec(dllimport)
35#endif
36#else
37#if defined(LIVEKIT_BUILDING_SDK)
38#define LIVEKIT_API __attribute__((visibility("default")))
39#else
40#define LIVEKIT_API
41#endif
42#endif
43
44// LIVEKIT_INTERNAL_API marks a symbol that is NOT part of the public ABI but
45// must remain visible so that the in-tree test binaries (which link against
46// the same shared library) can resolve it.
47//
48// External consumers must not rely on LIVEKIT_INTERNAL_API symbols; they may
49// change or disappear without notice.
50//
51// On Windows, internal symbols are exported the same way as public ones
52// because tests link via the standard import library; on Unix, hidden
53// visibility is overridden for these specific symbols only.
54
55#if defined(_WIN32)
56#define LIVEKIT_INTERNAL_API LIVEKIT_API
57#else
58#if defined(LIVEKIT_BUILDING_SDK)
59#define LIVEKIT_INTERNAL_API __attribute__((visibility("default")))
60#else
61#define LIVEKIT_INTERNAL_API
62#endif
63#endif