|
Hi Nedim,
I guess I have a slightly different problem than you have. My problem is because I don't have the PATH envivronment variable setup correctly. So I created this regDLL.bat file containing:
@echo off
set path=c:\matlab\v70\runtime\win32;%path%
regsvr32 /s /c "c:\projname\debug\MyProj.dll"
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "Performing registration"
exit 1
:VCEnd
And I call it from a Post Build Event in Visual Studio and now my registration problem is fixed !
What type of run-time error do you get when you start your application from the console?
Leslie
|
|
|
|
|
Hi Leslie,
Sorry, but I have not been notified about your reply, and today I saw your answer.
I managed the runtime error. It didn't really had nothing to do with the "PRJ0019" error.
So the Visual Studio still gives me:
"error PRJ0019: A tool returned an error code from "Performing registration"
If I register the COM from the console with regsvr32, everything is fine.
I use Matlab 6.0 Rel 12, and there is no folder like
"...\matlab\v70\runtime\win32".
You are probably using Matlab 7.0, that's why there is "\v70". What is the proper folder in the Matlab 6.0, because it has 22 different "win32" folders
Thanks!
Best Regards!
Nedim
|
|
|
|
|
Hi Thankx in advance.
I need some help in embedding DLLs in Matlab.
Can you give me any example to demonstrate this.
ok
pratap
|
|
|
|
|
When trying to compile your project under VC6, i get some errors:
1. i can't find any matlab.h under my C:\MATLAB7\extern\include directory, only mat.h . I assume those work the same?
2. it can't find a file named 'libmatlb.h'. I can find a library named libmatlb.lib under my C:\MATLAB7\extern\lib\win32\microsoft\msvc60 directory however. Do you know how I can fix this error?
Thanks,
Raquel Bujans
|
|
|
|
|
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
|
|
|
|