Hi all,

I am running into a problem which can be best descrivbed as below:

I have a C++ program which calls a matlab created library (compiled with MSVC2008). I am using Qt Creator as IDE and the program is being compiled with MSVC2008 as well. I followed all the instructions regarding the dll compilation and how to integrate it to my code (MCR installation, etc.). I then set up my project file this way:
1. an includepath to the folder where the .lib, .dll, .h have been created D:/C++ Offline/Matlab/
2. an includepath to .../MATLAB Compiler Runtime/v714/extern/include
3. I link the following libraries
D:/C++ Offline/Matlab/Test_Matlab.lib (the library I created)
C:/Program Files/MATLAB/MATLAB Compiler Runtime/v714/extern/lib/win32/microsoft/mclmcrrt.lib
4. I added also #include "Test_Matlab.h"

Here is the problem: When I compile the application and when calling mclInitializeApplication(NULL, 0) everyhing works ok (including the connection to matlab as the boolean returned evaluates to true) AS LONG AS Test_MatlabInitialize() is NOT in the code (even if it is not called at startup). However as soon as I add in the code Test_MatlabInitialize() (even if not called) I get the following error:

Stopped in thread 0 by: Exception at 0x1cdb4a, code 0xc0000005: write access violation at: 0x8, flags=0x0
Note 1: The log file can be found at the end of this post
Note 2: Stack shows blank line at level 0, _security_init_cookie at level 1, mainCRTStartup at level 2 and BaseProcessStart at level 3

What I don't understand is that it seems to be able to compile but not to run the program (crashes immediately) even if the function Test_MatlabInitialize() is not called (and i am sure it is not). Basically just adding Test_MatlabInitialize() in the code makes it crashes at startup.

Any help would be so much appreciated

Thanks

Ben


Log file:
Log_File.txt