drogue-ffi-compat

Crates.iodrogue-ffi-compat
lib.rsdrogue-ffi-compat
version0.1.0
sourcesrc
created_at2020-09-17 15:44:48.572923
updated_at2020-09-17 15:44:48.572923
descriptionC compatibility shims for FFI integrations
homepage
repository
max_upload_size
id289820
size17,534
Bob McWhirter (bobmcwhirter)

documentation

README

drogue-ffi-compat

A small utility library encompassing C-compatibility bits for making FFI integrations easier on non-libc platforms, such as Cortex-M.

Variadics

Support for C-style variadic functions is provided through a VaList struct, which knows how to manipulate memory the same as C in order to peel off variable length argument lists. It does not support direct implementation of variadic functions. In order to use it with true variadic functions, a bonafide C shim is required in order to construct a va_list, using normal va_start(...) and va_end(...) macros.

*printf(...)

This crate exports two printf compatible functions:

  • snprintf() implemented in bonafide C
  • vsnprintf() implemented in Rust.

Additionally, a minimal set of C-style printf formatting specifiers are marginally supported.

  • '%c'
  • '%s'
  • '%d'
  • '%x' and '%X'

Width and precision modifiers are consumed, but not currently respected. The goal is to support these functions well enough for simple integrations.

Commit count: 0

cargo fmt