Llamar a C desde MATLAB
calllib
Una biblioteca compartida es una recopilación de funciones que una aplicación carga de forma dinámica en el tiempo de ejecución. La interfaz de MATLAB es compatible con bibliotecas que contienen funciones definidas en archivos con encabezado C. Para llamar a funciones en bibliotecas de C++, utilice la interfaz que se describe en Llamar a C++ desde MATLAB.
Funciones
loadlibrary | Load C shared library into MATLAB |
unloadlibrary | Unload shared C library from memory |
calllib | Call function in C shared library |
libfunctions | Return information on functions in shared C library |
libfunctionsview | Display shared C library function signatures in window |
libisloaded | Determine if shared C library is loaded |
libpointer | Pointer object for use with shared C library |
libstruct | Convert MATLAB structure to C-style structure for use with shared C library |
Clases
lib.pointer | Pointer object compatible with C pointer |
Temas
- Call Functions in C Library Loaded with loadlibrary
How to call functions in external, shared C libraries from MATLAB using
calllib
. - Pass Arguments to Shared C Library Functions
How to construct MATLAB arguments compatible with the argument types found in the library functions.
- Represent Pointer Arguments in C Shared Library Functions
How to use
libpointer
to pass arguments by reference. - Represent Structure Arguments in C Shared Library Functions
Requirements for passing a MATLAB structure to an external library function.
- MATLAB Prototype Files
How to modify C header file information.
Solución de problemas
Limitations to Shared Library Support
C language features not supported.
Rules for using C language structures in a shared library.
Errors occur when the shared library is not a valid library.
Error de firma no correspondiente
Este error se produce cuando llama a una función sin los argumentos de entrada o de salida correctos, o si hay un error en la firma de función del archivo de encabezado.
MATLAB Terminates Unexpectedly When Calling Function in Shared Library
Some shared libraries, compiled as Microsoft® Windows® 32-bit libraries, use a calling convention that is incompatible with the default MATLAB calling convention.