Skip to content

Latest commit

 

History

History

include

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

C Header Files

Table of Contents generated with DocToc

This directory contains automatically generated C header files for the Synta FFI.

synta.h

The main C header file, generated from Rust FFI code using cbindgen.

Warning: Do not modify this file manually. It is automatically regenerated when building the synta-ffi crate.

To regenerate:

cargo build --release -p synta-ffi

Usage from C

Include the header in your C code:

#include <synta.h>

// Example: Decode an integer
const uint8_t data[] = {0x02, 0x01, 0x2A}; // INTEGER 42
SyntaDecoder* decoder = synta_decoder_new(data, sizeof(data), SyntaEncoding_Der);

SyntaInteger* integer = NULL;
if (synta_decode_integer(decoder, &integer) == SyntaErrorCode_Success) {
    int64_t value;
    if (synta_integer_to_i64(integer, &value) == SyntaErrorCode_Success) {
        printf("Value: %lld\n", (long long)value);
    }
    synta_integer_free(integer);
}

synta_decoder_free(decoder);

Linking

Using pkg-config

gcc myapp.c $(pkg-config --cflags --libs csynta) -o myapp

Using CMake

find_package(Synta REQUIRED)
target_link_libraries(myapp Synta::Synta)

Manual

gcc myapp.c -I/path/to/include -L/path/to/lib -lcsynta -o myapp

Documentation

See the following documents for more information: