diff options
author | Daya S Khudia <dskhudia@fb.com> | 2018-11-30 22:29:21 +0300 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-11-30 22:31:33 +0300 |
commit | 4e9fa6cf69d314c9e14d06cb3a4598531072b96a (patch) | |
tree | 5a7f3fbcbd8964499516d9a26ff7f7016bf86a2c /include/fbgemm/FbgemmBuild.h | |
parent | 4243ec024f442e59b5b4c9f0976fe521d4b5cbd2 (diff) |
Only export symbols that are required while building shared library
Summary: We now use -fvisibility=hidden flag for compiling fbgemm as a shared library and only explicitly exported symbols will be visible to applications linking against fbgemm shared library.
Reviewed By: jianyuh
Differential Revision: D13221957
fbshipit-source-id: 2283727a7f9bc8b05015a621ae1116f3cb3231bc
Diffstat (limited to 'include/fbgemm/FbgemmBuild.h')
-rw-r--r-- | include/fbgemm/FbgemmBuild.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/fbgemm/FbgemmBuild.h b/include/fbgemm/FbgemmBuild.h new file mode 100644 index 0000000..72c4e56 --- /dev/null +++ b/include/fbgemm/FbgemmBuild.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * All rights reserved. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ +#pragma once + +#if !defined(FBGEMM_API) + #if defined(FBGEMM_STATIC) + #define FBGEMM_API + #elif defined _WIN32 || defined __CYGWIN__ + #if (__GNUC__ || __clang__) && !(__MINGW64__ || __MINGW32__) + #if defined(FBGEMM_EXPORTS) + #define FBGEMM_API __attribute__((__dllexport__)) + #else + #define FBGEMM_API __attribute__((__dllimport__)) + #endif + #else + #if defined(FBGEMM_EXPORTS) + #define FBGEMM_API __declspec(dllexport) + #else + #define FBGEMM_API __declspec(dllimport) + #endif + #endif + #else + #if __clang__ || __GNUC__ >=4 || __INTEL_COMPILER + #define FBGEMM_API __attribute__((__visibility__("default"))) + #else + #define FBGEMM_API + #endif + #endif +#endif |