omni/core/Api.h
File members: omni/core/Api.h
// Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once
#include "Platform.h"
#ifdef __cplusplus
# define OMNI_EXTERN_C extern "C"
#else
# define OMNI_EXTERN_C
#endif
#define OMNI_EXPORT CARB_EXPORT
// Functions that wish to be exported from a .dll/.so should be decorated with OMNI_API.
//
// Functions related to modules, such omniGetModuleExports(), should be decorated with OMNI_MODULE_API.
#ifdef OMNI_COMPILE_AS_DYNAMIC_LIBRARY
# if OMNI_PLATFORM_WINDOWS
# define OMNI_API OMNI_EXTERN_C __declspec(dllexport)
# elif OMNI_PLATFORM_LINUX || OMNI_PLATFORM_MACOS
# define OMNI_API OMNI_EXTERN_C __attribute__((visibility("default")))
# endif
#else
# define OMNI_API OMNI_EXTERN_C
#endif
// Functions related to modules should be decorated with OMNI_MODULE_API. Currently, only omniGetModuleExports()
// qualifies.
#ifdef OMNI_COMPILE_AS_MODULE
# ifdef OMNI_COMPILE_AS_DYNAMIC_LIBRARY
# error "OMNI_COMPILE_AS_DYNAMIC_LIBRARY and OMNI_COMPILE_AS_MODULE cannot be both defined"
# endif
# if OMNI_PLATFORM_WINDOWS
# define OMNI_MODULE_API OMNI_EXTERN_C __declspec(dllexport)
# elif OMNI_PLATFORM_LINUX || OMNI_PLATFORM_MACOS
# define OMNI_MODULE_API OMNI_EXTERN_C __attribute__((visibility("default")))
# else
CARB_UNSUPPORTED_PLATFORM();
# endif
#else
# define OMNI_MODULE_API OMNI_EXTERN_C
#endif