Fix visibility to hidden 28/124928/1
authorsangwan.kwon <sangwan.kwon@samsung.com>
Thu, 13 Apr 2017 05:16:20 +0000 (14:16 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Thu, 13 Apr 2017 05:16:20 +0000 (14:16 +0900)
Change-Id: Icf005ec5d9e35adb3a7771936df5bf1ce098e674
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
api/tanchor/trust-anchor.hxx
src/CMakeLists.txt
src/api.cpp
src/macros.hxx [new file with mode: 0644]
tests/CMakeLists.txt

index fe165eb..ef6e910 100644 (file)
 #include <memory>
 
 
+#define TANCHOR_API __attribute__((visibility("default")))
+
+
 namespace tanchor {
 
-class TrustAnchor {
+class TANCHOR_API TrustAnchor {
 public:
        explicit TrustAnchor(const std::string &packageId,
                                                 const std::string &certsDir,
index b8a2919..849d68c 100644 (file)
@@ -31,9 +31,8 @@ INCLUDE_DIRECTORIES(SYSTEM ${TANCHOR_INCLUDE}
 
 ADD_LIBRARY(${TARGET_TANCHOR_LIB} SHARED ${${TARGET_TANCHOR_LIB}_SRCS})
 
-# TODO(sangwan.kwon) visibility needed to be hidden
 SET_TARGET_PROPERTIES(${TARGET_TANCHOR_LIB}
-       PROPERTIES COMPILE_FLAGS "-D_GNU_SOURCE -fPIC -fvisibility=default"
+       PROPERTIES COMPILE_FLAGS "-D_GNU_SOURCE -fPIC -fvisibility=hidden"
                           SOVERSION ${API_VERSION}
                           VERSION ${LIB_VERSION}
 )
index 890af6c..45abae7 100644 (file)
 #include "tanchor/trust-anchor.h"
 #include "tanchor/trust-anchor.hxx"
 
+#include "macros.hxx"
+
 using namespace tanchor;
 
+TANCHOR_API
 int trust_anchor_global_install(const char *package_id,
                                                                const char *app_certificates_path,
                                                                bool with_system_certificates)
@@ -32,6 +35,7 @@ int trust_anchor_global_install(const char *package_id,
        return ta.install(with_system_certificates);
 }
 
+TANCHOR_API
 int trust_anchor_usr_install(const char *package_id,
                                                         const char *app_certificates_path,
                                                         uid_t uid,
@@ -41,6 +45,7 @@ int trust_anchor_usr_install(const char *package_id,
        return ta.install(with_system_certificates);
 }
 
+TANCHOR_API
 int trust_anchor_global_launch(const char *package_id,
                                                           const char *app_certificates_path,
                                                           bool with_system_certificates)
@@ -49,6 +54,7 @@ int trust_anchor_global_launch(const char *package_id,
        return ta.launch(with_system_certificates);
 }
 
+TANCHOR_API
 int trust_anchor_usr_launch(const char *package_id,
                                                        const char *app_certificates_path,
                                                        uid_t uid,
@@ -58,6 +64,7 @@ int trust_anchor_usr_launch(const char *package_id,
        return ta.launch(with_system_certificates);
 }
 
+TANCHOR_API
 int trust_anchor_global_uninstall(const char *package_id,
                                                                  const char *app_certificates_path)
 {
@@ -65,6 +72,7 @@ int trust_anchor_global_uninstall(const char *package_id,
        return ta.uninstall();
 }
 
+TANCHOR_API
 int trust_anchor_usr_uninstall(const char *package_id,
                                                           const char *app_certificates_path,
                                                           uid_t uid)
diff --git a/src/macros.hxx b/src/macros.hxx
new file mode 100644 (file)
index 0000000..cae4f25
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+/*
+ * @file        macros.hxx
+ * @author      Sangwan Kwon (sangwan.kwon@samsung.com)
+ * @version     0.1
+ * @brief       Preprocessor macros
+ */
+#pragma once
+
+#ifndef TANCHOR_API
+#define TANCHOR_API __attribute__((visibility("default")))
+#endif
index 3ed8e83..869a38d 100644 (file)
@@ -57,7 +57,9 @@ SET(CAPI_LAUNCHER_SRCS main.cpp
 SET(INTERNAL_SRCS main.cpp
                                  test-curl.cpp
                                  test-util.cpp
-                                 test-certificate.cpp)
+                                 test-certificate.cpp
+
+                                 ${TANCHOR_SRC}/certificate.cpp)
 
 SET(TEST_INSTALLER ${TARGET_TANCHOR_TEST}-installer)
 SET(TEST_LAUNCHER ${TARGET_TANCHOR_TEST}-launcher)