邓丽君的歌曲一帘幽梦:matlab中mcc编译器参数的含义

来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 23:28:44

matlab中mcc编译器参数的含义

http://blog.sina.com.cn/s/blog_3e4367660100otgb.html
(2011-02-23 19:37:46) 转载 标签:

杂谈

分类: matlab

创建动态链接库主要有两种方法: 一种是使用Matlab 为VC++ IDE提供的Add-in。这种方法比较简单,方便快捷,只要在VC++中创建工程的时候选择Matlab Project Wizard,并且在接下来的Step 1 中的Visual Matlab Application Type选择Shared M-DLL 就可以了。接下来就是添加*.m 文件, 进行编译了。另一种方法就是使用Matlab 的mcc 命令将*.m文件编译为动态链接库( *.DLL)。因为Add-in 也是调用Compiler 的命令mcc 进行编译工作的, 而且有时候这个Add-in 还会出现不能使用的情况, 因此这里主要讨论使用mcc 命令的方法。
关于mcc 有很多参数可以使用, 而且有多种用法,主要参数如下:
Bold entries in the Comment/Options column indicate default values

-a filename

Add filename to the CTF archive


-b

Generate Excel-compatible formula function

Requires MATLAB Builder for Excel

-B filename[:arg[,arg]]

Replace -B filename on the mcc command line with the contents of filename

The file should contain only mcc command line options. These are MathWorks included options files:
-B csharedlib:fooC shared library
-B cpplib:fooC++ library

-c

生成C语言包装函数

Equivalent to
-T codegen

-d directory

输出到指定目录


-f filename

Use the specified options file, filename, when calling mbuild

mbuild -setup is recommended.

-g

生成 debugging 信息


-G

同 -g


-I directory

Add directory to search path for M-files

MATLAB path is automatically included when running from MATLAB, but not when running from DOS/UNIX shell.

-l

创建库函数的宏

等效于命令
-W lib -T link:lib

-m

生成C语言独立运行程序的宏

等效于命令
-W main -T link:exe

-M string

传递字符串给 mbuild

Use to define compile-time options.

-N

Clear the path of all but a minimal, required set of directories


-o outputfile

制定最终可执行文件的名字

Adds appropriate extension

-P directory

Add directory to compilation path in an order-sensitive context

Requires -N option

-R option

Specify run-time options for MCR

option =
-nojvm
-nojit

-S

Create Singleton MCR

Requires MATLAB Builder for COM

-T target

Specify output stage

target =codegen
compile:bin
link:bin
where bin =exe
lib

-v

显示详细; 显示编译步骤


-w option

显示警告信息

option = list
level
level:string
where level =disable
enable
error

-W type

Control the generation of function wrappers

type = main
cpplib:
lib:
none
com:compname,clname,version

-Y licensefile

Use licensefile when checking out a Compiler license


-z path

指定库文件和包含文件的路径


-?

显示帮助信息