Re: problem on C++ Shared Library



Thank you very much, John. I didn't know I was so careless :-)

But I still have a problem, for example:
After I call libFuncOneTerminate, I cannot call
libFuncTwoInitialize(), becasue there's an error message says:
"Unhandled exception at 0x006ea8c1 (mfc80ud.dll) in RecdEnvrnmt.exe:
0xC0000005: Access violation reading location 0xf78e2430."

void CDlg::OnBnClicked()
{
mclInitializeApplication(NULL,0);

libFuncOneInitialize()); //FuncOne
mlfFuncOne();
libFuncOneTerminate();

libFuncTwoInitialize(); //FuncTwo
mlfFuncTwo();
libFuncTwoTerminate();

mclTerminateApplication();
}

I wonder if someone has met this problem. I appreciate the help very
much!

John Reilly wrote:


Hi Jeff,

The documentation clearly says:

After you call mclTerminateApplication, you may not call
mclInitializeApplication again. No MathWorks functions may be
called
after mclTerminateApplication.

The page is in the MATLAB Compiler documentation, and is entitled
"Calling a Shared Library"

john.

Jeffrey wrote:


Hello,
I created a MFC program which invokes a function generated from
a
.m
file by matlab.

The problem is: the first time I call this function, it works
well.
But after
mclTerminateApplication();
when I want to call the function for a second time, there is a
problem with mclInitializeApplication();

That means, once the mclTerminateApplication() has been
executed,
mclInitializeApplication() fails to be executed again.

Does anyone meet this problem? Thank you very much!

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
My problem: The second time I click the button,
mclInitializeApplication fails to start.

void CDlg::OnBnClicked()
{
mclInitializeApplication(NULL,0);
libTESTInitialize());
mlfTEST();
libTESTTerminate();
mclTerminateApplication();
}
.


Loading