C++ MEX Development Utilities

버전 (19.5 KB) 작성자: Kesh Ikuma
C++ header files for MEX development
다운로드 수: 295
업데이트 날짜: 2018/3/21

Find the full descriptions and the latest files on GitHub @ https://github.com/hokiedsp/matlab-mexutils
This repo contains various C++ header files that are useful in developing C++ MEX functions and also serves to show how to set up CMake to build MEX functions.

C++ Header Files:

* include/mexObjectHandler.h

This file defines 2 main templates: mexObjectHandle class and mexObjectHandler() function.

- mexObjectHandle is an adoptation of Oliver Woodfords' MATLAB class wrapper:
The main difference is that mexObjectHandle manages the instance of wrapped class rather than Oliver's managing the pointer to a wrapped class object.

- mexObjectHandler() is an all-in-one template function to be called in mexFunction() to create a MEX backend to a MATLAB class. This function makes mexObjectHandle completely transparent to the developer. See documentation on GitHub for details.

* include/mexRuntimeError.h defines a custom runtime error based on std::runtime_error to include "id" field so mexErrMsgIdAndTxt() can be called in the catch block.

* include/mexGetString.h converts char string or scalar cellstr mxArray to std::string. Only single-byte encoding is supported.

* include/mexAllocator.h is a custom C++ allocator, which wraps mxMalloc, mxRealloc, and mxFree. It is useful to develop a Matlab-independent template class which must dynamically allocate memory internally and return the data to Matlab (avoiding memcpy). This allocator should only be used to allocate simple data types.

These header files have been developed only in Windows (MSVC+VSCode+Ninja+CMake). Please let me know if there are any issues, especially on other platforms, preferably on GitHub!

인용 양식

Kesh Ikuma (2024). C++ MEX Development Utilities (https://github.com/hokiedsp/matlab-mexutils), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2017a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
Help CenterMATLAB Answers에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!




GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.