From: Mark on
Oscar,

I assume you found the answer to your issue, but just in case anyone would like to know he was missing a linkage to the mclmcrrt.lib file, which should be located in the /extern/lib folder.

"Oscar " <osgarpe(a)hotmail.com> wrote in message <h44taa$9ou$1(a)fred.mathworks.com>...
> I'm facing the same problem. I have installed Matlab R2008a and a colleague has provided me with a C-compiled (R2008b) of an M-file.
> I'm using .net to access that library with no success (I'm given two linker errors back:
> - error LNK2019: unresolved external symbol _mxGetPr_proxy referenced in function _main
> - error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730_proxy referenced in function _main).
>
> Do you know if there's any solution to that?
>
> The folders (includes and libraries) are pointing at: development folder, matlab\extern\lib\win32, matlab\extern\include
>
> The source code, basically, is:
> #include "stdafx.h"
> #include "ect.h"
> #include <matrix.h>
>
> #pragma comment(lib, "libmx.lib")
> #pragma comment(lib, "libmat.lib")
> #pragma comment(lib, "libmex.lib")
> #pragma comment(lib, "libeng.lib")
> #pragma comment(lib, "ect.lib")
>
> void main(void)
> {
> double takeUpAux[1] = {1.3300};
> bool rdo = false;
> mxArray *takeUp, *ECTcalc;
>
> takeUp=mxCreateDoubleMatrix(1, 1, mxREAL);
> memcpy(mxGetPr(takeUp), takeUpAux, sizeof(double));
>
> ectInitialize();
>
> rdo=mlf_prognosticate_ECT(1, &ECTcalc, takeUp);
> ectTerminate();
>
> mxDestroyArray(takeUp);
> mxDestroyArray(ECTcalc);
> }
>
> "KK" <my_full_name(a)srlab.co.uk> wrote in message <gioc38$bca$1(a)fred.mathworks.com>...
> > Hi
> >
> > I have a .NET project written in C#.
> > I use DLLIMPORT to import functions such as mxCreateDoubleMatrix and mclInitializeApplication as well as custom M-File functions I wrote myself.
> >
> > The M-File functions are imported into my .NET project by compiling them into C shared libraries.
> >
> > I wanted to run my project on a test machine, so I installed MCR on it. But my project won't work.
> >
> > This is because MCR doesn't come with mclmcrrt78.dll which is where I found mxCreateDoubleMatrix etc.
> >
> > I looked through the DLLs MCR uses but I couldn't find the equivalent.
> >
> > So does this mean I can't use Matlab functions as a part of a .NET project on a machine that does not have full Matlab installed on it?
> >
> > Is there any workaround?
> >
> > Any help much appreciated.
> >
> > KK
From: Oscar on
Hi Mark,

yes, you are right I found out what was wrong. But now, after compiling and linking (which is ok) and, when I'm getting to the first line of code were I initialize the takeUp vector, it returns a non-valid memory address, i.e. 0x00000000.

I think that there's something wrong with the line but don't know what.

I copy here the line code
takeUp=mxCreateDoubleMatrix(1, 1, mxREAL);

Thanks

"Mark " <desertvet7(a)yahoo.com> wrote in message <h88qp4$g3g$1(a)fred.mathworks.com>...
> Oscar,
>
> I assume you found the answer to your issue, but just in case anyone would like to know he was missing a linkage to the mclmcrrt.lib file, which should be located in the /extern/lib folder.
>
> "Oscar " <osgarpe(a)hotmail.com> wrote in message <h44taa$9ou$1(a)fred.mathworks.com>...
> > I'm facing the same problem. I have installed Matlab R2008a and a colleague has provided me with a C-compiled (R2008b) of an M-file.
> > I'm using .net to access that library with no success (I'm given two linker errors back:
> > - error LNK2019: unresolved external symbol _mxGetPr_proxy referenced in function _main
> > - error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730_proxy referenced in function _main).
> >
> > Do you know if there's any solution to that?
> >
> > The folders (includes and libraries) are pointing at: development folder, matlab\extern\lib\win32, matlab\extern\include
> >
> > The source code, basically, is:
> > #include "stdafx.h"
> > #include "ect.h"
> > #include <matrix.h>
> >
> > #pragma comment(lib, "libmx.lib")
> > #pragma comment(lib, "libmat.lib")
> > #pragma comment(lib, "libmex.lib")
> > #pragma comment(lib, "libeng.lib")
> > #pragma comment(lib, "ect.lib")
> >
> > void main(void)
> > {
> > double takeUpAux[1] = {1.3300};
> > bool rdo = false;
> > mxArray *takeUp, *ECTcalc;
> >
> > takeUp=mxCreateDoubleMatrix(1, 1, mxREAL);
> > memcpy(mxGetPr(takeUp), takeUpAux, sizeof(double));
> >
> > ectInitialize();
> >
> > rdo=mlf_prognosticate_ECT(1, &ECTcalc, takeUp);
> > ectTerminate();
> >
> > mxDestroyArray(takeUp);
> > mxDestroyArray(ECTcalc);
> > }
> >
> > "KK" <my_full_name(a)srlab.co.uk> wrote in message <gioc38$bca$1(a)fred.mathworks.com>...
> > > Hi
> > >
> > > I have a .NET project written in C#.
> > > I use DLLIMPORT to import functions such as mxCreateDoubleMatrix and mclInitializeApplication as well as custom M-File functions I wrote myself.
> > >
> > > The M-File functions are imported into my .NET project by compiling them into C shared libraries.
> > >
> > > I wanted to run my project on a test machine, so I installed MCR on it. But my project won't work.
> > >
> > > This is because MCR doesn't come with mclmcrrt78.dll which is where I found mxCreateDoubleMatrix etc.
> > >
> > > I looked through the DLLs MCR uses but I couldn't find the equivalent.
> > >
> > > So does this mean I can't use Matlab functions as a part of a .NET project on a machine that does not have full Matlab installed on it?
> > >
> > > Is there any workaround?
> > >
> > > Any help much appreciated.
> > >
> > > KK