|
Hi Riazi!
Thanks for all excellent articles!
I have packed some MATLAB code into .dll but later I realized that for the distribution the user has to launch the "mglinstaller" from Mathworks to be able to start my application.
Is there any other way to distribute a MATLAB .dll for use on computer without Matlab Libraries installed.
What are your experiences with distribution? Do I have to pay something to Mathworks if I distribute an application that is using MATLAB libraries?
Thanks !
Nedim.
|
|
|
|
|
mglinstaller can be used in your own installer program to install MATLAB Dlls. The docuemnts also available from Mathworks that how you can employ it.
I did not distribute any MATLAB Dll or library for others and unfortunately I didn't know anything about it.
Please read the Mathworks license agreement!
A. Riazi
|
|
|
|
|
Thank you very much !
I will try to find out what are the rights about distribution of the dll files.
I was reading the Matlab Compiler (version 2.1) and I saw that it is possible to compile the Matlab code into C++ library by
mcc -p -W lib:mylibrary -T compile:lib mycode.m
what I get are files:
mylibrary.hpp
mylibrary.cpp
mylibrary.mlib
There is no ".lib" file !!!! I have expected to get a mylibrary.lib file and to use it like other static libraries with VC++. In the documentation of the M.Compiler it is written that Matlab Compiler can link against a *.mlib file.
So, I would kindly like to ask you,
How do I create statical C++ libraries from MATLAB Code that I can link with VC++ ??
Thanks !
Nedim.
|
|
|
|
|
Hi,
I didn't see any document for compiling MATLAB code to static library! But there are some shareware tools on the net that you can employ to change dynamic libraries to static libraries. Try them.
A. Riazi
|
|
|
|
|
|
Hi,
I searched +- the entire net, and didn't found any of these tools !?!.
*Can you give an example please?
*And, how should you set into visual studio 6 to link staticly (a non-mfc program....) ??
PS: love your article
kekkezek
|
|
|
|
|
|
Thanks a lot!
It might be a dumb question,
but does this means that
a .dll->always dynamic
a .lib->always static
???
|
|
|
|
|
This means you can convert DLL (dynamic link library) to LIB (static link library)!
A. Riazi
|
|
|
|
|
|
Hello ,
I tried with this tutorial to compile a simple function test.m , into a dll.
I'm using matlab 6.1 , Release 12.1 and MS VC++ 5.
My matlab function :
function OUT=test(PIC);
OUT=PIC-1;
Quiet difficult to make simplier ...
Then I used, the command line given in the tutorial
mcc -t -L C -W lib:TestLib -T link:lib -h test.m libmmfile.mlib
and I got 8 files
test.c
test.h
TestLib.c
TestLib.exp
TestLib.exports
TestLib.h
TestLib.lib
TestLib.mlib
Someone formerly said he got 9 files: he got a dll file too
Anyone knows where it disappeared ?
Then I follow
the tutorial and successfully compiled my project.
But when executing , MS VC++ claims TestLib.dll
Anyone got any advise ?
Thanks
|
|
|
|
|
Hi,
I've made a dll file with the matlab compiler, and now I have to access its functions in visual basic 6.
But I keep getting error messeges, like "cant find entry point". I also have had problems with the variable types, Matlab uses arrays even for integer numbers.
Can anyone help please?
It's for a school project.
thanks.
skin the sun, fall asleep, wish away, soul is cheap, lesson learnt, wish me luck, sooth the nerve, wake me up
|
|
|
|
|
|
I got the error messages in visual basic.
VC ++ compiled with out errors.
When I try to use the dlls, either from matlab or vc++ i got errors, saying that the function didn't exist, or the entry point error in vb 6.
Also, I read your articles, which are very good, but I don't seem to have the com toolbox in matlab. I have version 6.0
I appreciate your help.
skin the sun, fall asleep, wish away, soul is cheap, lesson learnt, wish me luck, sooth the nerve, wake me up
|
|
|
|
|
Guys,
I compiled my .M file into mex DLL. Now it has only one function to export: mexLibrary
How can I call that DLL?
When I am compiling it into shared library it gives me a lot of errors I do not want to deal with.
But if it would compile, I could have initialization functions like
.....Initialize
.....Terminate
exported from that library.
Please help!
Thanks!
|
|
|
|
|
Yerbolat wrote:
I compiled my .M file into mex DLL. Now it has only one function to export: mexLibrary
Mex Dlls are only suitable for MATLAB. No other languages can benefit from it. Mex files are suitable for speeding up the calculation in MATLAB.
If you want to create a dll from your m-file that can be called from another language, you must compiled it as shared Dll.
A. Riazi
|
|
|
|
|
this is my function
funtion a=X(b)
a=b*2;
funtion c=Y(d)
e=X(d);
c=e*3;
i known you're very busy,but can you show me more clearly;)
it's very important to me
thank you
dnqhung
|
|
|
|
|
HI
I have an DLL file that I want to open in MATLAB. I want to use output from DLL for further processing in MATLAB. DO anyone know how this is possible?
MItesh
|
|
|
|
|
|
Hello,
Does conversion to C-code from MATLAB m-files for these functions yield a significant speed increase? Ive heard that Matlab is wasteful of memory, especially in large functions with many loops.
thanks!
|
|
|
|
|
With some tricks your answer is yes. You can improve speed of MATLAB by compiling it. If you use C API directly with optimized code the speed is improved very well.
A. Riazi
|
|
|
|
|
Cannot include mat.h,matlab.h,matlab.
i'm new to VC++ and matlab,so i can't find why this error is coming.
please tell me!
(i'm using Matlab 6.5 R13 and VC++6.0,and I installed complete Matlab,VC++)
fatal error C1083: Cannot open include file: 'matlab.hpp':
No such file or directory
|
|
|
|
|
try followings:
option->directories->inclues files add your matlab path
D:\MATLAB6P5\EXTERN\INCLUDE\CPP
D:\MATLAB6p1\extern\include
|
|
|
|
|
|
Hello Riazi
this is my function
------------------------
function sum = matbs( a, b )
% sum
sum = a + b
------------------------
i save it as "matsum.m"
mcc -t -L C matsum.m
mcc -t -L Cpp matsum.m
(matsum.cpp matsum.hpp)
mcc -t -W lib:sum -T link:lib matsum.m
and there are 9 files
--------
matsum.c
matsum.h
sum.c
sum.exports
sum.h
sum.mlib
sum.dll
sum(exp file)
sum(lib file)
------------
i use sum.dll sum(lib file) and sum.h to VC6.0
i created project based on single dialog
1:copy the sum.dll and sum.lip,sum.h to the project directory(sum.dll to debug directory)
2:
in cpp
#include "matlab.h"
#include "sum.h"
3:project|setting->linking->object|library modulse :add sum.lib
-----------
void CXxmatlabDlg::OnButton1()
{
int a;
a=sum(1,2);
//but there is error :\my program\c\xxmatlab\xxmatlabDlg.cpp(179) : error C2065: 'sum' : undeclared identifier
CString str;
str.Format("%d",a);
AfxMessageBox(str);
}
-----------
why not still to use the sum function??
|
|
|
|