Results 1 to 2 of 2

Thread: Problem running Qt application with Matlab dll - write access violation

  1. #1
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem running Qt application with Matlab dll - write access violation

    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

  2. #2
    Join Date
    Mar 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem running Qt application with Matlab dll - write access violation

    Hello Ben

    I have exactly the same problem.
    My Qt app is quite complex so when I got the crash, I tried to create a simple console app without Qt libs and still get the problem.
    The mclInitializeApplication() function is also working but when I wrote any function call ( even if not called ) from the mathlab generated library, I get the access violation at the early begining of the programm launch.
    The debugger doesn't trace any load of the mathlab generated dll

    Did you find any solution ?

    Regards

Similar Threads

  1. Access violation -- qobject.cpp
    By willief in forum Newbie
    Replies: 9
    Last Post: 14th February 2011, 22:55
  2. Access Violation - Crashing Application
    By LIRiot in forum Qt Programming
    Replies: 9
    Last Post: 5th December 2010, 23:10
  3. Access Violation with VS2008
    By Takatschio in forum Qt Programming
    Replies: 3
    Last Post: 19th August 2010, 09:16
  4. QModelIndexList access reading violation
    By Daxos in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2010, 08:32
  5. OpenCV causes access violation only during timerEvent
    By derekkingston in forum Qt Programming
    Replies: 5
    Last Post: 19th February 2010, 08:56

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.