From 4572fec61d3744ed849bb0701304cd5deb800903 Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Sat, 25 Nov 2023 04:05:41 +0800 Subject: [PATCH] desktop (windows): fix lib build (#3456) --- .../common/src/commonMain/cpp/android/simplex-api.c | 7 +++++++ .../common/src/commonMain/cpp/desktop/simplex-api.c | 7 +++++++ libsimplex.dll.def | 1 + 3 files changed, 15 insertions(+) diff --git a/apps/multiplatform/common/src/commonMain/cpp/android/simplex-api.c b/apps/multiplatform/common/src/commonMain/cpp/android/simplex-api.c index 54478425f..4fd62524d 100644 --- a/apps/multiplatform/common/src/commonMain/cpp/android/simplex-api.c +++ b/apps/multiplatform/common/src/commonMain/cpp/android/simplex-api.c @@ -49,6 +49,13 @@ Java_chat_simplex_common_platform_CoreKt_initHS(__unused JNIEnv *env, __unused j // from simplex-chat typedef long* chat_ctrl; +/* + When you start using any new function from Haskell libraries, + you have to add the function name to the file libsimplex.dll.def in the root directory. + And do the same by adding it into flake.nix file in the root directory, + Otherwise, Windows and Android libraries cannot be built. +*/ + extern char *chat_migrate_init(const char *path, const char *key, const char *confirm, chat_ctrl *ctrl); extern char *chat_send_cmd(chat_ctrl ctrl, const char *cmd); extern char *chat_send_remote_cmd(chat_ctrl ctrl, const int rhId, const char *cmd); diff --git a/apps/multiplatform/common/src/commonMain/cpp/desktop/simplex-api.c b/apps/multiplatform/common/src/commonMain/cpp/desktop/simplex-api.c index 1c4ad1142..fb561dc38 100644 --- a/apps/multiplatform/common/src/commonMain/cpp/desktop/simplex-api.c +++ b/apps/multiplatform/common/src/commonMain/cpp/desktop/simplex-api.c @@ -22,6 +22,13 @@ Java_chat_simplex_common_platform_CoreKt_initHS(JNIEnv *env, jclass clazz) { // from simplex-chat typedef long* chat_ctrl; +/* + When you start using any new function from Haskell libraries, + you have to add the function name to the file libsimplex.dll.def in the root directory. + And do the same by adding it into flake.nix file in the root directory, + Otherwise, Windows and Android libraries cannot be built. +*/ + extern char *chat_migrate_init(const char *path, const char *key, const char *confirm, chat_ctrl *ctrl); extern char *chat_send_cmd(chat_ctrl ctrl, const char *cmd); extern char *chat_send_remote_cmd(chat_ctrl ctrl, const int rhId, const char *cmd); diff --git a/libsimplex.dll.def b/libsimplex.dll.def index 2d6e813d7..4255f4409 100644 --- a/libsimplex.dll.def +++ b/libsimplex.dll.def @@ -1,6 +1,7 @@ LIBRARY libsimplex EXPORTS hs_init + hs_init_with_rtsopts chat_migrate_init chat_send_cmd chat_send_remote_cmd