From 4e9fa6cf69d314c9e14d06cb3a4598531072b96a Mon Sep 17 00:00:00 2001 From: Daya S Khudia Date: Fri, 30 Nov 2018 11:29:21 -0800 Subject: 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 --- include/fbgemm/FbgemmBuild.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/fbgemm/FbgemmBuild.h (limited to 'include/fbgemm/FbgemmBuild.h') 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 -- cgit v1.2.3