Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

TXM.c

C/C++ bindings for TXM.

Example

#include "txm.h"
#include <stdio.h>

int main() {
    char *out = txm_render("E = mc^2");
    if (out) {
        printf("%s\n", out);
        txm_free_string(out);
    }
    return 0;
}

Build

Build the shared / static library:

cd bindings/c
cargo build --release

The compiled library will be at target/release/libtxm_c.{so,dylib,a}.

Link it with your C/C++ program:

# Dynamic linking (set LD_LIBRARY_PATH=target/release at runtime)
cc -o example example.c -L target/release -ltxm_c

# Static linking
cc -o example example.c target/release/libtxm_c.a