Writing Rust Modules #477
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello - a couple of follow up questions. Do you want to compile Rust modules for mainline emacs, or do you want to make a Rust module in emacs-ng? If you want to make a standalone Rust module that can be integrated into mainline emacs, there is the excellent repo https://github.com/ubolonton/emacs-module-rs which contains a Rust package that will allow you to produce a compatible shared library that can be used in mainline emacs. I have a personal example of such a module: https://github.com/DavidDeSimone/ng-js If you want to make a module that is statically linked to emacs-ng, then you should start by looking in the rust_src directory of emacs-ng (https://github.com/emacs-ng/emacs-ng/tree/master/rust_src). From there, I recommend looking at the content of #[allow(dead_code)]
fn init_syms() {
def_lisp_sym!(QCnull, ":null");
def_lisp_sym!(QCfalse, ":false");
def_lisp_sym!(QCobject_type, ":object-type");
def_lisp_sym!(QCarray_type, ":array-type");
def_lisp_sym!(QCnull_object, ":null-object");
def_lisp_sym!(QCfalse_object, ":false-object");
def_lisp_sym!(QCser_null_object, ":ser-null-object");
def_lisp_sym!(QCser_false_object, ":ser-false-object");
def_lisp_sym!(QCjson_config, ":json-config");
def_lisp_sym!(Qalist, "alist");
def_lisp_sym!(Qplist, "plist");
def_lisp_sym!(Qarray, "array");
}
include!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/out/parsing_exports.rs"
)); Does that answer your question? I can help if you have any follow ups. |
Beta Was this translation helpful? Give feedback.
Hello - a couple of follow up questions. Do you want to compile Rust modules for mainline emacs, or do you want to make a Rust module in emacs-ng?
If you want to make a standalone Rust module that can be integrated into mainline emacs, there is the excellent repo https://github.com/ubolonton/emacs-module-rs which contains a Rust package that will allow you to produce a compatible shared library that can be used in mainline emacs. I have a personal example of such a module: https://github.com/DavidDeSimone/ng-js
If you want to make a module that is statically linked to emacs-ng, then you should start by looking in the rust_src directory of emacs-ng (https://github.com/emacs-ng/emacs-ng/tre…