How to build .m file into .mex file

7 次查看(过去 30 天)
dukek
dukek 2015-10-24
回答: Rahul Goel 2015-10-28
I know that Matlab Coder is recommended for the task in question. But I don't have access to that toolbox. I can compile the .m file into a C library that probably can be linked to build a mex file. I am wondering if there is any instruction or hints on how to do this? Basically to do things manually as what the Matlab Coder does. Thanks in advance to anyone who can shed some lights on this.
The purpose is to protect the m code. The security of pcode is apparently not good enough. Try google matlab depcode ...

回答(1 个)

Rahul Goel
Rahul Goel 2015-10-28
You can refer to the following documentation for linking "C" libraries during creation of "mex" files: http://www.mathworks.com/help/matlab/ref/mex.html#inputs
Also, creating a mex file from a C code and generating C code using MATLAB coder are two very different things. I doubt if the functionality of MATLAB Coder can be replicated by building mex files from C libraries. Mex files are built by creating a wrapper over your source code and allowing it to be used as executable on MATLAB platform. On the other hand MATLAB Coder generates the appropriated C code by evaluating each line of the source MATLAB code.
Hope this helps.

类别

Help CenterFile Exchange 中查找有关 MATLAB Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by