---
name: "rtapi_init"
section: "3rtapi"
platform: "linux"
package: "linuxcnc-uspace-dev"
version: "1:2.9.4-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rtapi_init"
---

# rtapi\_init(3rtapi)

Sets up RTAPI

## NAME

rtapi\_init - Sets up RTAPI

## SYNTAX

 int rtapi\_init(const char \**modname*)

## ARGUMENTS

- *modname*

  The name of this rtapi module

## DESCRIPTION

**rtapi\_init** sets up the RTAPI.  It must be called by any module that intends to use the API, before any other RTAPI calls.

*modname* can optionally point to a string that identifies the module.  The string will be truncated at **RTAPI\_NAME\_LEN** characters.  If *modname* is **NULL**, the system will assign a name.

## REALTIME CONSIDERATIONS

Call only from within non-realtime or realtime init/cleanup code, not from relatime tasks.

## RETURN VALUE

On success, returns a positive integer module ID, which is used for subsequent calls to rtapi\_xxx\_new, rtapi\_xxx\_delete, and rtapi\_exit.  On failure, returns an RTAPI error code.
