필터 지우기
필터 지우기

MATLAB call compiled MCC program

조회 수: 4 (최근 30일)
T C
T C 2017년 7월 21일
댓글: Mikhail 2017년 7월 22일
We have a customer who has delivered some code, developed in MATLAB and compiled with mcc. They won't give uncompiled m code before you ask! Some of the functions are in shared libraries (this is their API), such that they can be called from a C++ or .NET and the system can be automated.
We would like to develop the automation in MATLAB, calling the mcc compiled functions directly from MATLAB.
1) Is this possible using mex (https://www.mathworks.com/help/matlab/write-cc-mex-files.html) or could it create some run time conflict?
2) Will wrapping the C++ library in a dot NET library, then calling the dot NET library from MATLAB help?

답변 (1개)

Titus Edelhofer
Titus Edelhofer 2017년 7월 21일
Hi,
unfortunately both will not work. The compiled code will need to run an instance of the MATLAB Compiler Runtime (MCR), but this can't run inside MATLAB itself. The only way would be to use remoting (see here) , so having a separate process.
Titus
  댓글 수: 2
T C
T C 2017년 7월 21일
Understood. Remoting sounds messy!
Would another option be, to build a set of command line executables in C++ or .NET for example - calling the API - and writing the results to a file. Then call these interim executables from the command line within MATLAB using 'system()'?
Mikhail
Mikhail 2017년 7월 22일
One viable option is to write a simple C/C++ daemon, which will load the compiled library (see Integrate a C/C++ Shared Library into an Application ) and provide some kind of RPC interface to the desired library functions. You will then use MATLAB's "udp" or "tcpclient" commands to talk to this daemon and call commands from the library.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by