runs-on: ubuntu-latest
# Ubuntu's version of clang doesn't support....anything that should work.
# Ubuntu is an utter trash OS and should generally never be used for anything.
- # We also require at least rustc 1.51 (ie https://github.com/rust-lang/rust/pull/79998),
- # so we use debian testing
- container: debian:bookworm
+ # We also require dotnet so we use fedora
+ container: fedora:39
strategy:
fail-fast: false
steps:
- name: Install required dependencies
run: |
- apt-get update
- apt-get -y dist-upgrade
- apt-get -y install cargo libstd-rust-dev-windows lld llvm git g++ clang curl gcc-mingw-w64-x86-64-win32 python3 mono-devel zip faketime
+ dnf install -y mingw64-gcc git cargo dotnet clang llvm lld faketime rust-std-static-x86_64-pc-windows-gnu which diffutils
- name: Checkout source code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install cbindgen
run: |
- git clone https://github.com/eqrion/cbindgen
- cd cbindgen/
- git checkout v0.20.0
- cargo update -p indexmap --precise "1.6.2" --verbose
- cargo install --locked --path .
+ cargo install cbindgen
- name: Checkout Rust-Lightning and LDK-C-Bindings git
run: |
git config --global safe.directory '*'
- name: Build Windows C# Bindings
run: |
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
- LDK_TARGET=x86_64-pc-windows-gnu faketime -f "2021-01-01 00:00:00" ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
+ LDK_TARGET=x86_64-pc-windows-gnu ./genbindings.sh ./ldk-c-bindings/ c_sharp false false
- name: Build Linux C# Bindings
run: |
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
run: |
cd c_sharp
./build-release-nupkg.sh
+ - uses: actions/upload-artifact@v3
+ with:
+ name: org.ldk.nupkg
+ path: c_sharp/org.ldk.nupkg
- name: Check latest auto-generated code is in git
run: |
# Checkout files that get updated with version information
run: |
export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
if ! diff ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg; then
- apt-get -y install diffoscope
+ dnf -y install diffoscope
diffoscope ldk-java-bins/"${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"org.ldk.nupkg c_sharp/org.ldk.nupkg || echo
exit 1
fi
typedef bool jboolean;
int64_t CS_LDK_allocate_buffer(int64_t len) {
- return MALLOC(len, "C#-requested buffer");
+ return (int64_t)MALLOC(len, "C#-requested buffer");
}
void CS_LDK_free_buffer(int64_t buf) {
- FREE(buf);
+ FREE((void*)buf);
}
jstring CS_LDK_get_ldk_c_bindings_version() {
}
#include "version.c"
-typedef int8_tArray (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
+typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
static invoker_l_l js_invoke_function_l_l;
int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
js_invoke_function_l_l = invoker;
return 0;
}
-typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, ptrArray b);
+typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
static invoker_l_ll js_invoke_function_l_ll;
int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
js_invoke_function_l_ll = invoker;
return 0;
}
-typedef int8_tArray (*invoker_l_)(int obj_ptr, int fn_id);
+typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
static invoker_l_ js_invoke_function_l_;
int CS_LDK_register_l__invoker(invoker_l_ invoker) {
js_invoke_function_l_ = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c, int8_tArray d);
+typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
static invoker_l_llll js_invoke_function_l_llll;
int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
js_invoke_function_l_llll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c, int8_tArray d, int64_t e);
+typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e);
static invoker_l_lllll js_invoke_function_l_lllll;
int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
js_invoke_function_l_lllll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c);
+typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
static invoker_l_lll js_invoke_function_l_lll;
int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
js_invoke_function_l_lll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int8_tArray b, int64_t c);
+typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
static invoker_l_Recipientll js_invoke_function_l_Recipientll;
int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
js_invoke_function_l_Recipientll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int8_tArray a, ptrArray b, int32_t c);
+typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
static invoker_l_llRecipient js_invoke_function_l_llRecipient;
int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
js_invoke_function_l_llRecipient = invoker;
return 0;
}
-typedef int8_tArray (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int8_tArray c);
+typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
static invoker_l_bll js_invoke_function_l_bll;
int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
js_invoke_function_l_bll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_tArray c, int64_t d, int8_tArray e, int8_tArray f);
+typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, int64_t f);
static invoker_l_llllll js_invoke_function_l_llllll;
int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
js_invoke_function_l_llllll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, jstring a, jstring b, jstring c, jboolean d);
+typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
static invoker_l_lllb js_invoke_function_l_lllb;
int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
js_invoke_function_l_lllb = invoker;
return 0;
}
-typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int8_tArray a, int64_tArray b, int32_t c);
+typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
static invoker_void_lli js_invoke_function_void_lli;
int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
js_invoke_function_void_lli = invoker;
return 0;
}
-typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int8_tArray a, int32_t b);
+typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
static invoker_void_li js_invoke_function_void_li;
int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
js_invoke_function_void_li = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, jboolean c);
+typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
static invoker_l_llb js_invoke_function_l_llb;
int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
js_invoke_function_l_llb = invoker;
return 0;
}
-typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int8_tArray b);
+typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
static invoker_l_sl js_invoke_function_l_sl;
int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
js_invoke_function_l_sl = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int8_tArray a, jboolean b);
+typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
static invoker_l_lb js_invoke_function_l_lb;
int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
js_invoke_function_l_lb = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int8_tArray a, int64_tArray b, int64_tArray c, int32_t d);
+typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
static invoker_l_llli js_invoke_function_l_llli;
int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
js_invoke_function_l_llli = invoker;
LDKStr key_str = key;
jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
Str_free(key_str);
- uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 53, primary_namespace_conv, secondary_namespace_conv, key_conv);
+ uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 53, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
LDKu8slice buf_var = buf;
int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
- uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 54, primary_namespace_conv, secondary_namespace_conv, key_conv, (int64_t)buf_arr);
+ uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 54, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
Str_free(key_str);
jboolean lazy_conv = lazy;
- uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 55, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
+ uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 55, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
LDKStr secondary_namespace_str = secondary_namespace;
jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
Str_free(secondary_namespace_str);
- uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 56, primary_namespace_conv, secondary_namespace_conv);
+ uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 56, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
typedef bool jboolean;
int64_t CS_LDK_allocate_buffer(int64_t len) {
- return MALLOC(len, "C#-requested buffer");
+ return (int64_t)MALLOC(len, "C#-requested buffer");
}
void CS_LDK_free_buffer(int64_t buf) {
- FREE(buf);
+ FREE((void*)buf);
}
jstring CS_LDK_get_ldk_c_bindings_version() {
}
#include "version.c"
-typedef int8_tArray (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
+typedef int64_t (*invoker_l_l)(int obj_ptr, int fn_id, int64_t a);
static invoker_l_l js_invoke_function_l_l;
int CS_LDK_register_l_l_invoker(invoker_l_l invoker) {
js_invoke_function_l_l = invoker;
return 0;
}
-typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, ptrArray b);
+typedef int64_t (*invoker_l_ll)(int obj_ptr, int fn_id, int64_t a, int64_t b);
static invoker_l_ll js_invoke_function_l_ll;
int CS_LDK_register_l_ll_invoker(invoker_l_ll invoker) {
js_invoke_function_l_ll = invoker;
return 0;
}
-typedef int8_tArray (*invoker_l_)(int obj_ptr, int fn_id);
+typedef int64_t (*invoker_l_)(int obj_ptr, int fn_id);
static invoker_l_ js_invoke_function_l_;
int CS_LDK_register_l__invoker(invoker_l_ invoker) {
js_invoke_function_l_ = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c, int8_tArray d);
+typedef int64_t (*invoker_l_llll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d);
static invoker_l_llll js_invoke_function_l_llll;
int CS_LDK_register_l_llll_invoker(invoker_l_llll invoker) {
js_invoke_function_l_llll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c, int8_tArray d, int64_t e);
+typedef int64_t (*invoker_l_lllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e);
static invoker_l_lllll js_invoke_function_l_lllll;
int CS_LDK_register_l_lllll_invoker(invoker_l_lllll invoker) {
js_invoke_function_l_lllll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_t c);
+typedef int64_t (*invoker_l_lll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c);
static invoker_l_lll js_invoke_function_l_lll;
int CS_LDK_register_l_lll_invoker(invoker_l_lll invoker) {
js_invoke_function_l_lll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int8_tArray b, int64_t c);
+typedef int64_t (*invoker_l_Recipientll)(int obj_ptr, int fn_id, int32_t a, int64_t b, int64_t c);
static invoker_l_Recipientll js_invoke_function_l_Recipientll;
int CS_LDK_register_l_Recipientll_invoker(invoker_l_Recipientll invoker) {
js_invoke_function_l_Recipientll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int8_tArray a, ptrArray b, int32_t c);
+typedef int64_t (*invoker_l_llRecipient)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
static invoker_l_llRecipient js_invoke_function_l_llRecipient;
int CS_LDK_register_l_llRecipient_invoker(invoker_l_llRecipient invoker) {
js_invoke_function_l_llRecipient = invoker;
return 0;
}
-typedef int8_tArray (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int8_tArray c);
+typedef int64_t (*invoker_l_bll)(int obj_ptr, int fn_id, jboolean a, int64_t b, int64_t c);
static invoker_l_bll js_invoke_function_l_bll;
int CS_LDK_register_l_bll_invoker(invoker_l_bll invoker) {
js_invoke_function_l_bll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, int64_tArray c, int64_t d, int8_tArray e, int8_tArray f);
+typedef int64_t (*invoker_l_llllll)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int64_t d, int64_t e, int64_t f);
static invoker_l_llllll js_invoke_function_l_llllll;
int CS_LDK_register_l_llllll_invoker(invoker_l_llllll invoker) {
js_invoke_function_l_llllll = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, jstring a, jstring b, jstring c, jboolean d);
+typedef int64_t (*invoker_l_lllb)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, jboolean d);
static invoker_l_lllb js_invoke_function_l_lllb;
int CS_LDK_register_l_lllb_invoker(invoker_l_lllb invoker) {
js_invoke_function_l_lllb = invoker;
return 0;
}
-typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int8_tArray a, int64_tArray b, int32_t c);
+typedef void (*invoker_void_lli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int32_t c);
static invoker_void_lli js_invoke_function_void_lli;
int CS_LDK_register_void_lli_invoker(invoker_void_lli invoker) {
js_invoke_function_void_lli = invoker;
return 0;
}
-typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int8_tArray a, int32_t b);
+typedef void (*invoker_void_li)(int obj_ptr, int fn_id, int64_t a, int32_t b);
static invoker_void_li js_invoke_function_void_li;
int CS_LDK_register_void_li_invoker(invoker_void_li invoker) {
js_invoke_function_void_li = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int8_tArray a, int64_t b, jboolean c);
+typedef int64_t (*invoker_l_llb)(int obj_ptr, int fn_id, int64_t a, int64_t b, jboolean c);
static invoker_l_llb js_invoke_function_l_llb;
int CS_LDK_register_l_llb_invoker(invoker_l_llb invoker) {
js_invoke_function_l_llb = invoker;
return 0;
}
-typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int8_tArray b);
+typedef int64_t (*invoker_l_sl)(int obj_ptr, int fn_id, int16_t a, int64_t b);
static invoker_l_sl js_invoke_function_l_sl;
int CS_LDK_register_l_sl_invoker(invoker_l_sl invoker) {
js_invoke_function_l_sl = invoker;
return 0;
}
-typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int8_tArray a, jboolean b);
+typedef int64_t (*invoker_l_lb)(int obj_ptr, int fn_id, int64_t a, jboolean b);
static invoker_l_lb js_invoke_function_l_lb;
int CS_LDK_register_l_lb_invoker(invoker_l_lb invoker) {
js_invoke_function_l_lb = invoker;
return 0;
}
-typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int8_tArray a, int64_tArray b, int64_tArray c, int32_t d);
+typedef int64_t (*invoker_l_llli)(int obj_ptr, int fn_id, int64_t a, int64_t b, int64_t c, int32_t d);
static invoker_l_llli js_invoke_function_l_llli;
int CS_LDK_register_l_llli_invoker(invoker_l_llli invoker) {
js_invoke_function_l_llli = invoker;
LDKStr key_str = key;
jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
Str_free(key_str);
- uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 53, primary_namespace_conv, secondary_namespace_conv, key_conv);
+ uint64_t ret = js_invoke_function_l_lll(j_calls->instance_ptr, 53, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
LDKu8slice buf_var = buf;
int8_tArray buf_arr = init_int8_tArray(buf_var.datalen, __LINE__);
memcpy(buf_arr->elems, buf_var.data, buf_var.datalen);
- uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 54, primary_namespace_conv, secondary_namespace_conv, key_conv, (int64_t)buf_arr);
+ uint64_t ret = js_invoke_function_l_llll(j_calls->instance_ptr, 54, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, (int64_t)buf_arr);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
jstring key_conv = str_ref_to_cs(key_str.chars, key_str.len);
Str_free(key_str);
jboolean lazy_conv = lazy;
- uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 55, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
+ uint64_t ret = js_invoke_function_l_lllb(j_calls->instance_ptr, 55, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv, (int64_t)key_conv, lazy_conv);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
LDKStr secondary_namespace_str = secondary_namespace;
jstring secondary_namespace_conv = str_ref_to_cs(secondary_namespace_str.chars, secondary_namespace_str.len);
Str_free(secondary_namespace_str);
- uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 56, primary_namespace_conv, secondary_namespace_conv);
+ uint64_t ret = js_invoke_function_l_ll(j_calls->instance_ptr, 56, (int64_t)primary_namespace_conv, (int64_t)secondary_namespace_conv);
void* ret_ptr = untag_ptr(ret);
CHECK_ACCESS(ret_ptr);
LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
echo "Checking that required release native libraries are present..."
ls packaging_artifacts/runtimes/win-x64/native/ldkcsharp.dll
ls packaging_artifacts/runtimes/linux-x64/native/libldkcsharp.so
-ls packaging_artifacts/lib/net3.0/csharpldk.dll
+ls packaging_artifacts/lib/net6.0/csharpldk.dll
cd packaging_artifacts
find . | xargs -L1 touch -d "2021-01-01 00:00 UTC"
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>net6.0</TargetFramework>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <Nullable>enable</Nullable>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <Deterministic>true</Deterministic>
+ <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
+ <DefaultItemExcludes>$(DefaultItemExcludes);test\**\*</DefaultItemExcludes>
+ </PropertyGroup>
+
+</Project>
<tags>bitcoin lightning ldk sdk non-custodial</tags>
<repository type="git" url="https://github.com/lightningdevkit/ldk-garbagecollected" />
<dependencies>
- <group targetFramework="net3.0" />
+ <group targetFramework="net6.0" />
</dependencies>
</metadata>
</package>
typedef bool jboolean;
int64_t CS_LDK_allocate_buffer(int64_t len) {
- return MALLOC(len, "C#-requested buffer");
+ return (int64_t)MALLOC(len, "C#-requested buffer");
}
void CS_LDK_free_buffer(int64_t buf) {
- FREE(buf);
+ FREE((void*)buf);
}
jstring CS_LDK_get_ldk_c_bindings_version() {
for arg_info in fn_line.args_ty:
fn_suffix += ty_to_c(arg_info.java_ty, arg_info)
fn_java_callback_args += ", " + arg_info.java_ty + " " + chr(ord("a") + idx)
- fn_c_callback_args += ", " + arg_info.c_ty + " " + chr(ord("a") + idx)
+ if arg_info.c_ty.endswith("Array") or arg_info.c_ty == "jstring":
+ fn_c_callback_args += ", int64_t " + chr(ord("a") + idx)
+ else:
+ fn_c_callback_args += ", " + arg_info.c_ty + " " + chr(ord("a") + idx)
if idx != 0:
fn_callback_call_args += ", "
fn_callback_call_args += chr(ord("a") + idx)
out_c += "\tuint64_t ret = js_invoke_function_" + fn_suffix + "(j_calls->instance_ptr, " + str(self.function_ptr_counter)
if fn_suffix not in self.function_ptrs:
- self.function_ptrs[fn_suffix] = {"args": [fn_java_callback_args, fn_c_callback_args], "ret": [fn_line.ret_ty_info.java_ty, fn_line.ret_ty_info.c_ty]}
+ caller_ret_c_ty = fn_line.ret_ty_info.c_ty
+ if fn_line.ret_ty_info.c_ty.endswith("Array") or fn_line.ret_ty_info.c_ty == "jstring":
+ caller_ret_c_ty = "int64_t"
+ self.function_ptrs[fn_suffix] = {"args": [fn_java_callback_args, fn_c_callback_args], "ret": [fn_line.ret_ty_info.java_ty, caller_ret_c_ty]}
self.function_ptrs[fn_suffix][self.function_ptr_counter] = (struct_name, fn_line.fn_name, fn_callback_call_args)
self.function_ptr_counter += 1
for idx, arg_info in enumerate(fn_line.args_ty):
if arg_info.ret_conv is not None:
- if arg_info.c_ty.endswith("Array"):
+ if arg_info.c_ty.endswith("Array") or arg_info.c_ty == "jstring":
out_c += ", (int64_t)" + arg_info.ret_conv_name
else:
out_c += ", " + arg_info.ret_conv_name
CS_PLATFORM_NAME="linux-x64"
LDK_JAR_TARGET=true
;;
+ "x86_64-redhat-linux"*)
+ LDK_TARGET_SUFFIX="_Linux-amd64"
+ CS_PLATFORM_NAME="linux-x64"
+ LDK_JAR_TARGET=true
+ ;;
"x86_64-apple-darwin"*)
LDK_TARGET_SUFFIX="_MacOSX-x86_64"
CS_PLATFORM_NAME="osx-x64"
fi
# Compiling C# bindings with Mono
- MONO_COMPILE="-out:csharpldk.dll -langversion:3 -t:library -unsafe c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/util/*.cs c_sharp/src/org/ldk/structs/*.cs"
if [ "$3" = "true" ]; then
- mono-csc -g $MONO_COMPILE
+ mono-csc -g -out:csharpldk.dll -langversion:3 -t:library -unsafe c_sharp/src/org/ldk/enums/*.cs c_sharp/src/org/ldk/impl/*.cs c_sharp/src/org/ldk/util/*.cs c_sharp/src/org/ldk/structs/*.cs
else
- mono-csc -optimize+ $MONO_COMPILE
+ cd c_sharp
+ dotnet build --configuration Release
+ cd ..
fi
echo "Building C# bindings..."
[ "$IS_APPLE_CLANG" = "false" ] && COMPILE="$COMPILE -flto"
[ "$IS_MAC" = "false" ] && LINK="$LINK -Wl,--no-undefined"
[ "$IS_WIN" = "false" ] && LINK="$LINK -Wl,--lto-O3"
- [ "$IS_WIN" = "true" ] && LINK="$LINK --target=x86_64-pc-windows-gnu -L/usr/lib/gcc/x86_64-w64-mingw32/12-win32/ -lbcrypt -static-libgcc"
+ [ "$IS_WIN" = "true" ] && LINK="$LINK --target=x86_64-pc-windows-gnu -L/usr/lib/gcc/x86_64-w64-mingw32/12-win32/ -lbcrypt -lntdll -static-libgcc"
[ "$IS_WIN" = "true" ] && COMPILE="$COMPILE --target=x86_64-pc-windows-gnu"
LDK_LIB="$1"/lightning-c-bindings/target/$LDK_TARGET/release/libldk.a
if [ "$IS_MAC" = "false" -a "$IS_WIN" = "false" -a "$4" = "false" ]; then
- LINK="$LINK -Wl,--version-script=c_sharp/libcode.version"
+ LINK="$LINK -Wl,--version-script=c_sharp/libcode.version -Wl,--build-id=0x0000000000000000"
fi
- $COMPILE -o bindings.o -c -O3 -I"$1"/lightning-c-bindings/include/ c_sharp/bindings.c
- $COMPILE $LINK -o libldkcsharp_release$LDK_TARGET_SUFFIX.so -O3 bindings.o $LDK_LIB -lm
+ # When building for Windows, a timestamp is included in the resulting dll,
+ # so we have to build with faketime.
+ faketime -f "2021-01-01 00:00:00" $COMPILE -o bindings.o -c -O3 -I"$1"/lightning-c-bindings/include/ c_sharp/bindings.c
+ faketime -f "2021-01-01 00:00:00" $COMPILE $LINK -o libldkcsharp_release$LDK_TARGET_SUFFIX.so -O3 bindings.o $LDK_LIB -lm
[ "$IS_APPLE_CLANG" != "true" ] && llvm-strip libldkcsharp_release$LDK_TARGET_SUFFIX.so
if [ "$LDK_JAR_TARGET" = "true" ]; then
# Copy resulting native binary for inclusion in release nuget zip
- mkdir -p c_sharp/packaging_artifacts/lib/net3.0/
- cp csharpldk.dll c_sharp/packaging_artifacts/lib/net3.0/
+ mkdir -p c_sharp/packaging_artifacts/lib/net6.0/
+ cp c_sharp/bin/Release/net6.0/csharpldk.dll c_sharp/packaging_artifacts/lib/net6.0/
mkdir -p c_sharp/packaging_artifacts/runtimes/"$CS_PLATFORM_NAME"/native/
if [ "$IS_WIN" = "true" ]; then