使用预置的 MATLAB C/C++ 库接口
要调用 C 或 C++ 库中的函数,请使用 MATLAB®
clib 命名空间如果您有已发布的对接 C/C++ 共享库的 MATLAB 接口,则可以直接在 MATLAB 中使用这些类和函数,从而在 MATLAB 和 C/C++ 之间来回传递数据。
函数
clibArray | 为 C++ 库函数创建 MATLAB clib 数组 |
clibConvertArray | 将 MATLAB 基本数组或结构体数组转换为 C++ 对象的 MATLAB 数组 |
clibConfiguration | Set run-time configuration parameters for C/C++ library interface (自 R2023a 起) |
CLibraryConfiguration | C/C++ library interface environment information (自 R2023a 起) |
clibIsNull | 确定 C++ 对象是否为空 |
clibIsReadOnly | 确定 C++ 对象是否为只读 |
clibRelease | 从 MATLAB 中释放 C++ 对象 |
underlyingValue | 在 MATLAB 中创建的 C++ 枚举对象的基础数值 |
主题
配置 C/C++ 库接口
- Set Run-Time Library Path for C/C++ Interface
If the C/C++ library has a compiled library file, then that file and its dependencies must be on your system path or run-time search path (rpath). - Load C/C++ Library In-Process or Out-of-Process
Execute C/C++ functions in processes that are the same as or separate from the MATLAB process. - Display Help for MATLAB Interface to C++ Library
Display information about the members of MATLAB interface.
在 MATLAB 中使用 C/C++ 库
- Call Functions in C/C++ Compiled Library
To call a function in the library, use the MATLAB
clibnamespace. - Pass clib.array to C++ Functions
The term clib array is the MATLAB object representation of C++ native arrays andstd::vectortypes. - Create MATLAB Array of C++ Objects
CallclibArrayto create MATLAB clib array for C++ library functions. - MATLAB 类型到 C++ 类型的映射
当您将 MATLAB 数据作为参量传递给 C++ 方法或函数时,MATLAB 会将数据转换为最适合在 C++ 语言中表示该数据的类型。 - C++ Names That Are Invalid in MATLAB
How MATLAB handles C++ names that are invalid MATLAB names. - Use C++ Objects and Functions in parfor Loops
How to take advantage of parallel computing resources using a MATLAB interface to a C++ compiled library.
疑难解答
Troubleshooting MATLAB Interface to C/C++ Library Run-Time Issues
Resolve unexpected run-time errors when calling functions in a published MATLAB interface to a C/C++ shared library.
Troubleshooting Calls to C/C++ Library Functions
Resolve unexpected issues when calling functions in a C/C++ shared library.
C/C++ library features not supported in MATLAB.
Using C++ exceptions in MATLAB.
