% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ffi.R
\name{tcc_bind}
\alias{tcc_bind}
\title{Bind symbols with type specifications}
\usage{
tcc_bind(ffi, ...)
}
\arguments{
\item{ffi}{A tcc_ffi object}

\item{...}{Named list of symbol definitions. Each definition is a list with:
\itemize{
\item args: List of fixed FFI argument types (e.g., list("i32", "f64"))
\item returns: FFI type for return value (e.g., "f64", "cstring")
\item variadic: Set TRUE for C varargs functions
\item varargs: Legacy typed variadic tail (exact/prefix mode)
\item varargs_types: Allowed scalar FFI types for true variadic tails
\item varargs_min: Minimum number of trailing varargs
\item varargs_max: Maximum number of trailing varargs (required for
true variadic mode, defaults to \code{varargs_min})
\item code: Optional C code for the symbol (for embedded functions)
}
Callback arguments should use the form \code{callback:<signature>} (e.g.,
\code{callback:double(double)}). The generated trampoline expects a
\code{tcc_callback_ptr(cb)} to the corresponding user-data parameter in
the C API. For thread-safe scheduling, use
\code{callback_async:<signature>} which enqueues the call on the main
thread and returns a default value immediately.}
}
\value{
Updated tcc_ffi object (for chaining)
}
\description{
Define symbols with Bun-style type specifications for API mode.
This is the core of the declarative FFI API.
}
\examples{
ffi <- tcc_ffi() |>
  tcc_bind(
    add = list(args = list("i32", "i32"), returns = "i32"),
    greet = list(args = list("cstring"), returns = "cstring")
  )
}
