Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: compile to exe
Date: Fri, 19 Jun 2009 06:34:01 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 19
Message-ID: <h1fbgp$ka1$1@fred.mathworks.com>
References: <h1egve$ag1$1@fred.mathworks.com> <h1eig5$dm2$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245393241 20801 172.30.248.37 (19 Jun 2009 06:34:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 19 Jun 2009 06:34:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:548840


"Mark Hayworth" <hayworth@none.com> wrote in message <h1eig5$dm2$1@fred.mathworks.com>...
> "hailiang shen" <hlshen2005@gmail.com> wrote in message <h1egve$ag1$1@fred.mathworks.com>...
> > Hi All, 
> > 
> > I am trying to compile a project, including a .m file, a .dll file, and a .mex file. The m file calls function in dll and mex file. Is it possible to compile them into one .exe file? 
> > 
> > Thanks,
> > 
> > Hailiang
> -----------------------------------------------------
> Not in my experience.  It will bundle in all m files that the main m file calls but not the DLLs and mex files.  You will have to ship those separately along with your m-file's exe.  Bundle all those up using an installer program (such as Wise or Install Shield or many others), along with sample data files, documentation, mat files, Excel templates, and whatever other ancillary files you want to distribute with your package.

Well from my experiences, it seems DLL (old MEX format?) and MEX files (both are called from M-files as OP specified) should be recognized by the compiler dependency analyzer and automatically packed together during the compilation.

Now, if the a DLL is used by the MEX file, then you need to manually bundle them separately as Mark suggested, or you might try to trick the compiler by make it recognize as old-MEX format with the pragma %#function, or using MCC option "-a".

You might want to modify PATH environment to tell the deployed machine where to look for the DLL.

Bruno