From 522ad2d73d76f2e8c94a12f4a68a0daf4b758b1e Mon Sep 17 00:00:00 2001 From: kirby Date: Wed, 8 May 2024 19:04:17 +0800 Subject: [PATCH] add ffi bind Signed-off-by: kirby --- interfaces/kits/cj/BUILD.gn | 4 +++- interfaces/kits/cj/src/config_policy_ffi.h | 21 ++----------------- interfaces/kits/cj/src/config_policy_mock.cpp | 2 ++ 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/interfaces/kits/cj/BUILD.gn b/interfaces/kits/cj/BUILD.gn index ef420c1..31cbee1 100644 --- a/interfaces/kits/cj/BUILD.gn +++ b/interfaces/kits/cj/BUILD.gn @@ -29,6 +29,8 @@ ohos_shared_library("cj_config_policy_ffi") { "bounds_checking_function:libsec_shared", "hilog:libhilog", "hisysevent:libhisysevent", + "napi:cj_bind_ffi", + "napi:cj_bind_native", ] sources = [ "../../../frameworks/dfx/hisysevent_adapter/hisysevent_adapter.cpp", @@ -46,7 +48,7 @@ ohos_shared_library("cj_config_policy_ffi") { if (current_os == "mingw") { defines += [ "WINDOWS_PLATFORM" ] } - + innerapi_tags = [ "platformsdk" ] subsystem_name = "customization" part_name = "config_policy" } diff --git a/interfaces/kits/cj/src/config_policy_ffi.h b/interfaces/kits/cj/src/config_policy_ffi.h index 4151256..17ffea9 100644 --- a/interfaces/kits/cj/src/config_policy_ffi.h +++ b/interfaces/kits/cj/src/config_policy_ffi.h @@ -16,27 +16,10 @@ #ifndef CONFIG_POLICY_FFI_H #define CONFIG_POLICY_FFI_H -#include - -#define FFI_EXPORT __attribute__((visibility("default"))) +#include "ffi_remote_data.h" +#include "cj_common_ffi.h" extern "C" { - const int32_t SUCCESS_CODE = 0; - struct CArrString { - char** head; - int64_t size; - }; - - struct RetDataCArrString { - int32_t code; - CArrString data; - }; - - struct RetDataCString { - int32_t code; - char* data; - }; - FFI_EXPORT RetDataCArrString CJ_GetCfgDirList(); FFI_EXPORT RetDataCArrString CJ_GetCfgFiles(const char* relPath); FFI_EXPORT RetDataCString CJ_GetOneCfgFile(const char* relPath); diff --git a/interfaces/kits/cj/src/config_policy_mock.cpp b/interfaces/kits/cj/src/config_policy_mock.cpp index c53d335..a0791c1 100644 --- a/interfaces/kits/cj/src/config_policy_mock.cpp +++ b/interfaces/kits/cj/src/config_policy_mock.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#define FFI_EXPORT __attribute__((visibility("default"))) + extern "C" { FFI_EXPORT int CJ_GetCfgDirList = 0; FFI_EXPORT int CJ_GetCfgFiles = 0; -- Gitee