# ffi

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [connect-full.txt](https://docs.redpanda.com/connect-full.txt)

---
title: ffi
latest-connect-version: 4.93.0
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-redpanda-tag: v26.1.9
docname: processors/ffi
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: processors/ffi.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/processors/ffi.adoc
description: Invoke a function within a shared library as a processing step.
page-git-created-date: "2026-01-05"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/connect/components/processors/ffi.md -->

**Available in:** Self-Managed

Invoke a function within a shared library as a processing step.

#### Common

```yml
processors:
  label: ""
  ffi:
    library_path: "" # No default (required)
    function_name: "" # No default (required)
    args_mapping: "" # No default (required)
    signature:
      return:
        type: "" # No default (required)
      parameters: [] # No default (required)
```

#### Advanced

```yml
processors:
  label: ""
  ffi:
    library_path: "" # No default (required)
    function_name: "" # No default (required)
    args_mapping: "" # No default (required)
    signature:
      return:
        type: "" # No default (required)
      parameters: [] # No default (required)
```

The `ffi` processor allows you to dynamically load shared libraries (.so, .dylib, or .dll files) and invoke their functions as a processing step. This enables integration with external C/C++ libraries without requiring custom Go code or rebuilding Redpanda Connect.

The processor uses `dlopen` (or platform equivalent) to load the specified library at runtime, looks up the function by name, and invokes it with arguments provided through Bloblang mapping. Function signatures are defined using the `signature` field, specifying parameter and return types.

Results are returned as an array, where the first element is the return value (if not void), followed by any output parameters in their declaration order.

## [](#requirements)Requirements

Ensure that your environment meets the following requirements:

-   This component is only available in cgo-enabled builds of Redpanda Connect (not in the Redpanda CLI or Docker image).

    You can either [download a prebuilt cgo-enabled binary](https://docs.redpanda.com/connect/install/prebuilt-binary/) or [build Redpanda Connect from source with cgo enabled](https://docs.redpanda.com/connect/install/build-from-source/).


## [](#fields)Fields

### [](#args_mapping)`args_mapping`

The bloblang expression that returns an array of arguments to pass into the foreign function.

**Type**: `string`

```yaml
# Examples:
args_mapping: root = [42, now().ts_unix_nano(), content()]
```

### [](#function_name)`function_name`

The name of the function to load from the shared library.

**Type**: `string`

```yaml
# Examples:
function_name: MyExternCFunction
```

### [](#library_path)`library_path`

The path to the shared library (.so, .dylib or .dll) file to load dynamically.

**Type**: `string`

```yaml
# Examples:
library_path: libbar.6.so

# ---

library_path: libfoo.dylib
```

### [](#signature)`signature`

The signature of the function.

**Type**: `object`

### [](#signature-parameters)`signature.parameters[]`

The parameters of the function.

**Type**: `object`

### [](#signature-parameters-out)`signature.parameters[].out`

If the parameter provided is an 'out' parameter, meaning if the function mutates the value, and the resulting value should be returned. This is only valid for pointer types.

**Type**: `bool`

**Default**: `false`

### [](#signature-parameters-type)`signature.parameters[].type`

The data type of the parameter.

**Type**: `string`

| Option | Summary |
| --- | --- |
| byte* | A pointer to a byte array is provided as an argument. Note this byte array cannot be referenced once the function returns. args_mapping must return a byte array or string type for this argument, and the parameter in C for this should be void*. |
| int32 | A 32 bit signed integer is provided as an argument |
| int64 | A 64 bit signed integer is provided as an argument |

### [](#signature-return)`signature.return`

The configuration for the function’s result.

**Type**: `object`

### [](#signature-return-type)`signature.return.type`

The data type of function’s return value

**Type**: `string`

| Option | Summary |
| --- | --- |
| int32 | A 32 bit signed integer is returned |
| int64 | A 64 bit signed integer is returned |
| void | The function returns nothing |

## [](#examples)Examples

### [](#call-a-libc-function)Call a libc function

This is an example of loading libc.so and calling a function on linux.

```yaml
pipeline:
  processors:
    - ffi:
        library_path: libc.6.so
        function_name: memcmp
        args_mapping: 'root = ["foo", "bar", 3]'
        signature:
          return:
            type: int32
          parameters:
            - type: byte*
            - type: byte*
            - type: int64
```