Simulink Real-Time C API

The Simulink® Real-Time™ C API consists of a series of C functions that you can call from a C or C++ custom program. This API is designed for multi-threaded operation on a 64-bit target computer.

The Simulink Real-Time C API DLL consists of C functions that you can incorporate into a custom program. A user can use an application written through either interface to load, run, and monitor a real-time application without interacting with MATLAB®. Using the Simulink Real-Time C API, you write the custom program in a high-level language (such as C, C++, or Java®) that works with a real-time application. This option requires that you are an experienced programmer.

The xpcapi.dll file contains the Simulink Real-Time C API dynamic link library, which contains over 90 functions you can use to access the real-time application. Because xpcapi.dll is a dynamic link library, your program can use run-time linking rather than static linking at compile time. Accessing the Simulink Real-Time C API DLL is beneficial when you are building custom programs using development environments such as Microsoft® Foundation Class Library/Active Template Library (MFC/ATL), DLL, and console programs integrating with third-party product APIs (for example, Altia®).

All custom Simulink Real-Time C API programs must link with the xpcapi.dll file (Simulink Real-Time C API DLL). Also associated with the dynamic link library is the xpcinitfree.c file. This file contains functions that load and unload the Simulink Real-Time C API. You must build this file along with the custom Simulink Real-Time C API program.

The Simulink Real-Time C API consists of blocking functions. For communications between the development and target computers, a default timeout of 5 seconds controls how long a target computer can take to communicate with a development computer.

The documentation reflects the fact that the API is written in the C programming language. However, the API functions are usable from other languages, such as C++ and Java.

    Note:   To write a non-C custom program that calls functions in the Simulink Real-Time C API library, refer to the compiler documentation for a description of how to access functions from a library DLL. You must follow these directions to access the Simulink Real-Time C API DLL.

Was this topic helpful?