简体   繁体   English

Delta Chat Rust 集成在 Spring 启动应用程序中

[英]Delta Chat Rust integration in Spring Boot App

i'm currently building a Spring Boot Application and i want to send some Mails via Chat over IMAP.我目前正在构建一个 Spring 引导应用程序,我想通过 IMAP 聊天发送一些邮件。 Deltachat implements COI. Deltachat 实施 COI。 DeltaChat offers an API written in RUST. DeltaChat 提供用 RUST 编写的 API。 https://github.com/deltachat/deltachat-core-rust https://github.com/deltachat/deltachat-core-rust

As written here https://support.delta.chat/t/bindings-for-java/970如此处所写https://support.delta.chat/t/bindings-for-java/970

The Java Bindings should be implemented by the Android App https://github.com/deltachat/deltachat-android/tree/master/src/com/b44t/messenger Java 绑定应由 Android 应用https://github.com/deltachat/deltacomchat-android/tree/messenger/s实现

Plus I need to get up the JNI: https://github.com/deltachat/deltachat-android/tree/master/jni另外我需要起床JNI: https://github.com/deltachat/deltachat-android/tree/master/jni

I copied the two folders jni and messenger into a separate java project along with deltachat-core-rust Projekt.我将 jni 和 messenger 这两个文件夹与 deltachat-core-rust Projekt 一起复制到了一个单独的 java 项目中。 However, I am not sure how to connect the Java classes to the C code.但是,我不确定如何将 Java 类连接到 C 代码。 What is the best way to do this?做这个的最好方式是什么? In the JNI folder there is still the Android.mk class, do I have to implement what is implemented there myself?在 JNI 文件夹中仍然有 Android.mk class,我必须自己实现那里实现的内容吗?

The dc_wrapper.c file contains C functions of the form Java_com_b44t_* that implements the native methods in the corresponding Java package . The dc_wrapper.c file contains C functions of the form Java_com_b44t_* that implements the native methods in the corresponding Java package .

In order to get this working on any platform, you need to create a build system (Make, CMake, Xmake, Ninja, ...) that:为了让它在任何平台上工作,您需要创建一个构建系统(Make,CMake,Xmake,Ninja,...):

  1. compiles the Rust crate into a static library;将 Rust crate 编译成 static 库;
  2. compiles the dc_wrapper.c into a dynamically loadable library that is linked with the rust crate.dc_wrapper.c编译为与 rust 板条箱链接的动态可加载库。

Finally, you can use the com.b44t.messenger.* classes from Java, which should automatically load the library created in step two.最后,您可以使用 Java 中的com.b44t.messenger.*类,它应该会自动加载在第二步中创建的库。 The android.mk file is mostly android-specific compile options, so you should not look too hard at it. android.mk文件主要是 android 特定的编译选项,所以你不应该看得太仔细。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM