|
Compiler tells you that there is a declaration of function '_mylibInitialize' in your unit or some included header file and have definition in some external file you did not included into project.
You didn't included mylib.lib, and there is a reference in mylib.h.
Go to the menu, under the Project item select Add to Project.. and find this library in dialog box.
Remember, you must include mclmcr.lib, too.
|
|
|
|
|
I have an example in Cpp, but project is too big (about 3.5MB), and I can't upload it to the my site. If you send me a mail, I will send it to you.
|
|
|
|
|
Hi ,
I am trying to compile a simple matlab function to shared library. I have used
following option.
mcc -t -L C -W lib:MeanFunctionLib -T link:lib MeanFunction.m libmmfile.mlib
Following error got generated.
"mcc -t -L C -W lib:MeanFunctionLib -T link:lib MeanFunction.m libmmfile.mlib
The filename, directory name, or volume label syntax is incorrect.
LINK : fatal error LNK1104: cannot open file "_lib3223.def"
LINK : fatal error LNK1141: failure during build of exports file
??? Error using ==> mbuild
Unable to complete successfully
??? Error: An error occurred while shelling out to mbuild (error code = 1).
Unable to build executable (specify the -v option for more information).
Error in ==> C:\MATLAB6p1\toolbox\compiler\mcc.dll"
Kindly let me know , if I am using the correct option or not.
regards.
Kumar Shwetaketu
India.
|
|
|
|
|
Someone please help me to do this
i have my algorithms written in Matlab.
i want to call my matlab algorithms in my C program so that i can sent values to my matlab code and get the result.
i dont want to use the matlab engine to do it.
i would like to use the matlab compiler option to do that.
if anyone can help me plz explain me with an example code
i have a compiler version of 4.6 and a matlab version of 7.4.
i am using visual studio 2005 for doing my c program
please do help me
sindhu
|
|
|
|
|
Hello,
This is my first time using M-Files within my C++ code.
We another group that creates the M-files and I would like to know if I need to make a DLL for every single M-File or they can be grouped and one DLL can be created for multiple M-Files? If that's the case, how can I tell which M-files can be combined into one DLL?
Thank You,
|
|
|
|
|
I want to compile matlab image processing function such as imread, imshow to DLL, and then I want to use that DLL java project
but always i have this error message :
Warning: File: affiche Line: 2 Column: 5
References to "imread" will produce a run-time error because it is an undefined
function or variable.
how i can compile the m files and use them in java project?
Please help me.
thanks.
|
|
|
|
|
You must consider that you can't compile all matlab codes including those that related to eval function, GUI and structures. The imread uses many of them and you can't compile it.
Best regards,
A. Riazi
|
|
|
|
|
Hi Riazi,
I saw your article on creating the DLL and *.lib (mean calculation code) from *.m file and using it with the C/C++ code. I tried with the Matlab Version 6.1 Release 12.1 and it worked.
However, when I try code with MATLAB 7, I fail to compile the code. Seems the matlab 7 does not have "matlab.h" header itself along with some lib files. How can use the DLL with Matlab 7.
Kindly help in this regard.
with respect.
Kumar Shwetaketu
India.
|
|
|
|
|
Hi! I tried the same procedure as in the article...
I wrote my m-file and compiled it with
"mcc -B csharedlib:libmy myFuncr.m -v" and then I made a little program in C to use the dll I had created...I can compile it but when running it I got an access violation error at a line where I'm trying to create a mxArray *:
<br />
mxArray* in1 = NULL;<br />
mxArray* in2 = NULL;<br />
<br />
in1 = mxCreateDoubleMatrix(4,4, mxREAL); <big>Here I get the error</big>
the error I get say "Project xxxxx.exe raised exception class EAccessViolation with message 'Access violation at address 00000000.Read of address 00000000'"
I'm using borland to compile (Borlan c++ builder 6) and matlab version 7.
Can you help me? Thanks!
|
|
|
|
|
i want to import a C code for keyboad in matlab so wht can i do wht files i shuld include can u plz tell me the functions i shuld use..
regards
fayyaz ahmad
lahore pakistan
digitaleye1@gmail.com
|
|
|
|
|
you can call a c function in your matlab code by converting your c code to a mex function.
for that u have to include a gateway function like as shown below. If u have a matlab installed then the help document will give you all the reqired help
Let’s look at a simple example of C code and its MEX-file equivalent. Here is a C computational function that takes a scalar and doubles it.
#include<stdio.h>
#include <math.h>
void timestwo(double y[], double x[])
{
y[0] = 2.0*x[0];
return;
}
Below is the same function written in the MEX-file format.
include ur c header files<br />
#include "mex.h"<br />
void timestwo(double y[], double x[])<br />
{<br />
y[0] = 2.0*x[0];<br />
}<br />
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,<br />
const mxArray *prhs[])<br />
{<br />
double *x, *y;<br />
int mrows, ncols;<br />
<br />
if (nrhs != 1) {<br />
mexErrMsgTxt("One input required.");<br />
} else if (nlhs > 1) {<br />
mexErrMsgTxt("Too many output arguments");<br />
}<br />
<br />
mrows = mxGetM(prhs[0]);<br />
ncols = mxGetN(prhs[0]);<br />
if (!mxIsDouble(prhs[0]) || mxIsComplex(prhs[0]) ||<br />
!(mrows == 1 && ncols == 1)) {<br />
mexErrMsgTxt("Input must be a noncomplex scalar double.");<br />
}<br />
<br />
plhs[0] = mxCreateDoubleMatrix(mrows,ncols, mxREAL);<br />
<br />
x = mxGetPr(prhs[0]);<br />
y = mxGetPr(plhs[0]);<br />
<br />
timestwo(y,x);<br />
}<code><br />
<br />
save this code as a .c function(programname.c)<br />
go to the matlab command window<br />
if you are doing the mex function for the first time you have to do a mex setup<br />
<br />
the following are the steps to do that<br />
This example shows the process of setting your default compiler to the<br />
Microsoft Visual C++ Version 6.0 compiler.<br />
mex -setup(type in command window)<br />
Please choose your compiler for building external interface (MEX)<br />
files.<br />
Would you like mex to locate installed compilers [y]/n? n<br />
Select a compiler:<br />
[1] Compaq Visual Fortran version 6.6<br />
[2] Lcc C version 2.4<br />
[3] Microsoft Visual C/C++ version 6.0<br />
[0] None<br />
Compiler: 3<br />
Your machine has a Microsoft Visual C/C++ compiler located at<br />
D:\Applications\Microsoft Visual Studio. Do you want to use this<br />
compiler [y]/n? y<br />
Please verify your choices:<br />
Compiler: Microsoft Visual C/C++ 6.0<br />
Location: C:\Program Files\Microsoft Visual Studio<br />
Are these correct?([y]/n): y<br />
The default options file:<br />
"C:\WINNT\Profiles\username\ApplicationData\MathWorks\MATLAB\R13<br />
\mexopts.bat" is being updated from ...<br />
Building MEX-Files<br />
<br />
If the specified compiler cannot be located, you are given the message:<br />
The default location for compiler-name is directory-name,<br />
but that directory does not exist on this machine.<br />
Use directory-name anyway [y]/n?<br />
Using the setup option sets your default compiler so that the new compiler is<br />
used every time you use the mex script.<br />
<br />
Once you have chosen you compiler build ur program by typing<br />
mex programname.c<br />
then you can check your program by typing "programname(2)" in command window<br />
or you can create an m file to call this program<br />
%mfile<br />
x=2;<br />
y=programname(x);<br />
disp(y)<br />
%mfile ends<br />
<br />
check it out
|
|
|
|
|
How can I do the download of the MatlabSharedLib_demo.zip?
Best regards!
Giovani Tonel
Ch.engineer
|
|
|
|
|
Just login and then download.
A. Riazi
|
|
|
|
|
Dear i am working on image processing so i want to use MATLAB functions like FFT,DFT etc.how can i use that functions in VC#.NET.and which MATLAB version me need, what's the way to make .dll or .com for C#.please reply me soon because it's my final project for my BS.
|
|
|
|
|
for accessing the matlab functions in C# you need to have a compiler and matlab builder for .NET installed Version 7 of matlab will support it (i am working with version 7 dont know about other versions)
you need to make a dll for your matlab cod using the deploytool and add it as a reference in your C# code
The matlab help document coming along with the .net builder will help you do ur work.
Sindhu krishnan
|
|
|
|
|
Thanks Sindhu krishnan for your reply.
i have VS.NET 2005 and MATLAB 7.0 can you please send me a simple example for it that how to convert the MATLAB code into DLL and then use it in .NET.
Please reply me soon.
Thanks again for your reply.
Shakeel
|
|
|
|
|
Hi All,
I need help in using debugger with MATLAB .net NE builder.
I have a VB project in C# and a project in MATLAB,
I created a MATLAB dll(matlabtest.dll) using deployment tool with target as .NET assembly. Then in VB project I gave the reference of matlabtest.dll.
Then in VB project via debug--> "attached to process" I attached the MATLAB.exe.
On starting the execution of VB project in debug mode the entire execution goes well, but when I try to debug the matlab.dll, I am not able to step-in into the matlab code. The execution is not hitting any break point in MATLAB code.
am I missing any step in configuration,
any help would be highly appreciated.
Dhruva Kumar
|
|
|
|
|
Hello,
I am trying to compile a Matlab .m file into .c and to produce an executable.
As a test I wrote the following Matlab function:
function sample2(a)
fprintf('a=%d\n',a);
as you can see, this is a one line function that simply prints the value of a.
Afterwards I compiled it with:
mcc -mg sample2.m
This has indeed produced the appropriate c files and exe and the executable do ran.
There is only one problem; When I write in the command line: sample2 3 (in order to run the exe) the output is 'a=51', that is, the ascii value of 3 is printed. When I ran the Matlab function inside Matlab the output is fine, that is, 'a=3'.
Can you help me?
Thanks,
Amit
|
|
|
|
|
Hello everybody,
I'm developping in Delphi 2005 and my question is if it's possible to compile a dll with MAthlab and to use it with Delphi for my software.
Thanks for your help.
|
|
|
|
|
I also programmed in Delphi, and interested for Malab libraries first to use them in Delphi. Later, I started with Borland Cpp.
Unfortunately, there is no much hope for Delphi. Matlab generate function declarations, and already have header files for its libraries. If you want to use this libraries, you must rewrite these declarations in Delphi, and even after that I think it would't work. For dinamical linking it is harder and I don't know the solution.
|
|
|
|
|
Please helpme!!!
I have a simple function in MatLab 7 R14 Sp1:
function DispMsg;
msgbox('Success','Message Title');
I compiled it with MatLab compiler version 4.1 with this command:
mcc -W lib:DispMsg -T link:lib DispMsg.m
When I use the following VB6 code I get an error #453 Can't find DLL entry point...
Private Declare Function DispMsg Lib "D:\Data\DLL Compiler\DispMsg.dll" () As Long
Private Const DEF_SCRIPT_DLL As String = "D:\Data\DLL Compiler\DispMsg.dll"
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Sub cmdCallDll_Click()
On Error GoTo PROC_ERR
Dim lngRet As Long
Dim ret As Integer
' -- Works as expected
lngRet = LoadLibrary(DEF_SCRIPT_DLL)
If lngRet <> 0 Then
' -- Should call a simple messagebox
Call DispMsg '<- Raises error
' -- Check
If ret = 0 Then
MsgBox "Call to TestScript failed ", vbExclamation, "DLL Test"
Else
' Add code...
End If
Else
MsgBox "Could not load dll '" & DEF_SCRIPT_DLL & "' ", vbExclamation, "DLL Test"
End If
PROC_EXIT:
' -- Clean up
If lngRet <> 0 Then FreeLibrary lngRet
Exit Sub
PROC_ERR:
Err.Source = "modCode::Main(Sub)"
MsgBox Err.Description & vbCrLf & vbCrLf & _
"Error Number " & Err.Number & vbCrLf & _
"Error Source " & Err.Source & " ", vbExclamation, "DLL Test"
Debug.Print Err.Description
Resume PROC_EXIT
End Sub
I will appreciate any suggestions.
Boris
boris_velen@swissre.com
Boris
boris_velen@swissre.com
|
|
|
|
|
hey icesktr1
have u got a solution ?
bcz I also need the solution ...
plz let me know how to connect between VB6 and Matlab
I will be waiting ..
kindly contat me
kashifishaq@msn.com
|
|
|
|
|
Please can u help me because i want to use c++ dll through matlab and i don't know how.
please help me, it's urgent ...
urgent !
|
|
|
|
|
Hello all.
I have C++ ver 6.0 on my computer and matlab R12 on another computer (license problems).
I have followed math works insrturctions for Solution Number: 1-18CBI, which is "How do I create a C - shared library with MATLAB Compiler 3.0".
Due to the different computer problem i have copied matlab libraries which are required to be included in the C++ project
$MATLAB\extern\include\cpp;
$MATLAB\extern\include;
$MATLAB\extern\lib\win32\microsoft\msvc60;
This doesnt work !!!! how come?
at the begining i had to add some *.dll and *.h files.
when i have finished, nothing happens and the c++ says it has an external link problem
pls advise.
Regards
Udi
|
|
|
|
|
I try to compile your exemple in matlab(6.5): mcc -t -L C -W lib:MeanFunctionLib -T link:lib MeanFunction.m libmmfile.mlib but I have error with mcc.dll . why?????????please help me.
Thanks
I whould to use it in builder c++(6.0)
lamionne
-- modified at 13:52 Saturday 18th March, 2006
|
|
|
|