Home > Blockchain >  Red & Rust integration
Red & Rust integration

Time:12-05

Does anyone know how to use view from Rust? Do I need to link libRed.dll on windows? What functions to extern?
Must I try to disassemble it?
I’m using compiled Red, not interpreted, so libRedRT.lib isn’t a solution, I guess.

CodePudding user response:

It seems the Red contributor who started such binding with Rust deleted his repo (or maybe moved it out of Github).

We have not yet tried interfacing Red with Rust in the core team, but it should not be difficult to achieve as Red is provided as a library you can link to C at run-time. All you need is to do is convert the C import definitions for libRed to Rust format. Then you should be able to write a simple HelloWorld for it, translating the following C code to Rust:

#include "red.h"

int main() {
    redOpen();
    redPrint(redString("Hello World!"));
    redClose();
    return 0;
}

The whole libRed API is described there and you can find some usage examples from C in the tests.

EDIT: I have found another Rust binding for libRed.

  • Related