1/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16#include <stdbool.h>
17
18#ifndef TENSORFLOW_CORE_TPU_LIBTFTPU_H_
19#define TENSORFLOW_CORE_TPU_LIBTFTPU_H_
20
21// Unfortunately we have to add an Fn suffix because we cannot have the same
22// name for both a function and a element within a struct in the global
23// namespace in gcc. This restriction doesn't exist in clang.
24#define TFTPU_ADD_FN_IN_STRUCT(FnName) decltype(FnName)* FnName##Fn;
25
26#ifdef SWIG
27#define TFTPU_CAPI_EXPORT
28#else
29#if defined(_WIN32)
30#ifdef TF_COMPILE_LIBRARY
31#define TFTPU_CAPI_EXPORT __declspec(dllexport)
32#else
33#define TFTPU_CAPI_EXPORT __declspec(dllimport)
34#endif // TF_COMPILE_LIBRARY
35#else
36#define TFTPU_CAPI_EXPORT __attribute__((visibility("default")))
37#endif // _WIN32
38#endif // SWIG
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44TFTPU_CAPI_EXPORT void TfTpu_Initialize(bool init_library, int num_args,
45 const char** args);
46
47#ifdef __cplusplus
48}
49#endif
50
51struct TfTpu_BaseFn {
52 TFTPU_ADD_FN_IN_STRUCT(TfTpu_Initialize);
53};
54
55#endif // TENSORFLOW_CORE_TPU_LIBTFTPU_H_
56