Help: VS2005 Compile * .m file

all

I have test.m (Matlab source code) that implements the A () function; and the main.cpp file (will call A ()).

As you know, we can take the following steps:

  • use matlab to compile test.m (mcc -), will generate: test.dll, test.ctf, test.h.

  • copy the file test.dll and test.ctf, test.h to the VS2005 project. in main.cpp, call A () in test.dll.

But when I release the program, I will also pack the test.dll file together.

And in another way, can I use VS2005 to compile both test.m and main.cpp, which will only generate main.dll, main.ctf, main.h .. (I will only release main.dll, main. CTF, main.h,).

this means that I am compiling test.m in main.cpp.

And I tried this way, in VS2005 ---> Build Events → pre-Build Event → command line: mcc C -w lib: test test.m

and it will generate an average test.ctf file (only test.ctf, no test.dll). But I do not know how to compile test.ctf in main.cpp?

Can someone help me?

thank.

+5
source share
1 answer

You can do it the other way around and add your main.cpp to the matlab build process: I don't know the exact syntax, but you can add your main.cpp file to mcc / mbuild and it will add it for the dll for you. When using deploytool in gui mode, just drag and drop the c / C ++ files into the resources area and compile them into dll. This way you will have one dll containing only m-code and native C ++ code.

, : deploytool: . mcc, mbuild, cl (MS-). , mcc , cl , mbuild ( , ). , VS dll , , Matlab.

, . , MCR , - dll.

+1

All Articles