Path: news.mathworks.com!not-for-mail
From: "John Reilly" <jrhokie1.nospam@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: interface .NET/ VC++ and Matlab
Date: Tue, 22 Jan 2008 13:43:02 +0000 (UTC)
Organization: Barron Associates
Lines: 51
Message-ID: <fn4rt6$2cq$1@fred.mathworks.com>
References: <fmkotq$4tv$1@fred.mathworks.com>
Reply-To: "John Reilly" <jrhokie1.nospam@yahoo.com>
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 1201009382 2458 172.30.248.37 (22 Jan 2008 13:43:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 22 Jan 2008 13:43:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 796958
Xref: news.mathworks.com comp.soft-sys.matlab:446956


The answer depends upon the code you want to call from 
MATLAB.

If unmanaged (i.e. straight C/C++), the (probably) easiest 
thing to do is to wrap it in an old-school Windows DLL.  
You can use MATLAB loadlibrary/calllib to access it.  don't 
forget to export your DLL's entry points as extern "C".  If 
your interface is simple, this will be the easiest.  If 
your interface is more complicated, you may want to write a 
C mex wrapper that you call from MATLAB, and that wrapper 
links to your library, translating the MX-Array arguments 
to/from C.

If your code is managed (i.e. runs on the CLR), much more 
difficult.  In that case, you'll need to create a C mex 
wrapper that hosts the CLR for you.  CodeProject.com will 
help you out there.

hth.

reilly.



"Vihang Patil" <vihang_patil@yahoo.com> wrote in message 
<fmkotq$4tv$1@fred.mathworks.com>...
> Hello
> I would like to interface .Net or VC++ with Matlab.
> In brief, there is some code which is developed in .NET 
or 
> VC++ and now I want to execute that code in Matlab.
> I have absolutely no programming knowledge and knowhow 
> whatsoever about .NET and VC++ and one of my friend will 
> be developing the code in either .NET or VC++ which I am 
> interested to execute in Matlab
> Now, my questions are;
> 1. How do I do this? 
> 2. Should I use the code from .NET/VC++ and modify 
somehow 
> to make it work in Matlab? or should I ask him to give me 
> a dll? or something else which can be called in Matlab?
> 
> Please help. If some one can provide any small example 
> would really be useful
> 
> Regards
> Vihang
> 
> 
>