locked
The application failed to initialize properly (0x80000003). Click on OK to terminate the application. RRS feed

  • Question

  • I have been trying to use libraries from the scripting language Octave inside a Visual C++ program. I posted to their mailing lists, but received no response. So, here's the issue. I can compile my program successfully, but running the program results in the error message:

    "The application failed to initialize properly (0x80000003). Click on OK to terminate the application."

    I understand it is unlikely to find anyone who knows much about Octave so I will try  to fill you in as much as possible. This is where you can go to download the software if you are interested in it:

    http://octave.sourceforge.net/

    As stated, I'm trying to compile code while using the library created by code used by Octave. In this case, I'm trying to use what is called a .mex file. .Mex files are c++ code which can be called by Octave and also have the capability to call other Octave functions. They are compiled with a command mkoctfile --mex, which in turn calls the associated compiler. Instructions for setting up the compiler were found here: http://www.geocities.jp/tmoctwin/msvcoct.html

    Anyway, I created a sample program to try to link to. It follows her (addLib.cpp):_________________________________________________________________________

    #include "mex.h"
    #include <iostream>

    class addLib {
    private:

    public:
            addLib();
            double add(double* v1, double* v2);
            void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
    };

    addLib::addLib() {}

    void addLib::mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
            double *a, *b;
            a = mxGetPr(prhs[0]);
            b = mxGetPr(prhs[1]);
           
            plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL); // Works
            double* result = (double*) mxGetPr(plhs[0]);
            result[0] = add(a,b);
    }

    double addLib::add(double* v1, double* v2) {
            return v1[0] + v2[0];
    }

    _________________________________________________________________________

    Using Tatsuro's guide I had previously set up a compiler that was able to compile this code. Anyway, compilation went through and was entirely successful. I can run addLib from Octave without a problem and debug it as well.

    Unfortunately, the next step was more of a problem.

    I created a c++ file called incl in a project called inclMex.

    _________________________________________________________________________

    #include "C:\Documents and Settings\bkirklin\SVN\trunk\octave\SRC\addLib.cpp"
    #include <stdio.h>

    int main() {
           
            printf("Hello");
           
            double *a, *b, *res;
            addLib *ab = new addLib();

            a[0] = 1;
            b[0] = 1;
            printf("%d",ab->add(a,b));
            return 0;
    }

    _________________________________________________________________________

    After adding several paths to the linker into Octave's inerds, I was able to get this to compile without a fault detected. Then I began receiving errors when running the program. At first it complained about not being able to find the Octave dlls. So I copied them all into the same location as my .exe. Then it complained about windows dlls. So I copied all of those. Here's the resulting collection of files located in my debug directory:

    _________________________________________________________________________

    [.]                           libjasper-1.dll
    [..]                          libjpeg-62.dll
    ATL80.dll                     liblapack.dll
    cruft.dll                     libMagick++-10.dll
    gluegen-rt.dll                libMagick-10.dll
    inclMex.exe                   libncurses-5.dll
    inclMex.exp                   libnetcdf-4.dll
    inclMex.ilk                   libpango-1.0-0.dll
    inclMex.lib                   libpangocairo-1.0-0.dll
    inclMex.pdb                   libpangowin32-1.0-0.dll
    jogl.dll                      libpcre-0.dll
    jogl_awt.dll                  libpng13.dll
    jogl_cg.dll                   libportaudio-2.dll
    libarpack.dll                 libreadline-5.dll
    libblas.dll                   libtiff.dll
    libbz2.dll                    libwmflite-0-2-7.dll
    libcairo-2.dll                libxml2-2.dll
    libcurl.dll                   mfc80.dll
    libfftw3-3.dll                mfc80u.dll
    libfreetype-6.dll             mfcm80.dll
    libgd-2.dll                   mfcm80u.dll
    libglib-2.0-0.dll             Microsoft.VC80.ATL.manifest
    libglpk-0.dll                 Microsoft.VC80.CRT.manifest
    libgmodule-2.0-0.dll          Microsoft.VC80.MFC.manifest
    libgobject-2.0-0.dll          msvcm80.dll
    libgsl-0.dll                  msvcp80.dll
    libgslcblas-0.dll             msvcr80.dll
    libgthread-2.0-0.dll          octave.dll
    libhdf5-0.dll                 octinterp.dll
    libiconv-2.dll                zlib1.dll
    libintl-8.dll

    _________________________________________________________________________

    Well, that effectively took care of all of the errors reflecting anything specific. The next
    error said this: (appears 2xs)

    "The application failed to initialize properly (0x80000003). Click Ok to terminate the aplication."

    Further research led me to believe that this was the result of either more missing dlls or a bad manifest file somewhere. I'm not sure, however, which manifest file is missing where or similarly which dll. I'm using Microsoft Visual Studios 2005 and the version of Octave compiled with Microsoft Visual Studios 2005.

    This page here seemed it might be of use, but did not result in any improvement:
    http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/eb134e02-5d32-44ae-aa26-c106c082c72a/

    This page seemed relevant as well, and seems to confirm my diagnoses of the problem, but does not appear to have a solution to help me:
    http://www.nabble.com/Re:-mkoctave-MSVC-2008-Express-td15912053.html

    As a side note, I tried to use an existing package, OctaveEmbedded, for similar reasons, (http://wiki.octave.org/wiki.pl?OctaveEmbedded) from Octave forge. I added its files to my project and recieved the same error code after removing the bit about addLib. So this problem appears to be of wider scope and just what I was trying to do.

    Its understandable if no one here has experience with octave or a solution as this isn't a microsoft product, but the failure seems to be one that occasionally crops for many different users who are doing similar things to myself. So anyway, any ideas or thoughts?
    Monday, August 11, 2008 2:14 PM

Answers

  • Hi,

    Please don't move the Visual C++ runtime libraries to your debug directory, keep it in winsxs directory.

    Thanks!
    • Marked as answer by Yan-Fei Wei Sunday, August 17, 2008 11:51 PM
    Sunday, August 17, 2008 1:50 PM

All replies

  • It might worth noting also that attempting to debug the function leads to this, which just enforces the belief that its something to do with a manifest.

    crtlib.c (lines 344-361)

    #if defined (_CRT_CHECK_MANIFEST)
                if (!_check_manifest(hDllHandle))
                {
                    __try
                    {
                        _NMSG_WRITE(_RT_CHECKMANIFEST);
                    }
                    __except( EXCEPTION_EXECUTE_HANDLER )
                    {
                        OutputDebugString(_GET_RTERRMSG(_RT_CHECKMANIFEST));
                        DebugBreak();
                    } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< DEBUGGER FAILS RIGHT HERE <<<<<<<<<<<

                    _ioterm();          /* shut down lowio */
                    _mtterm();          /* free TLS index, call _mtdeletelocks() */
                    _heap_term();       /* heap is now invalid! */
                    return FALSE;
                }
    • Proposed as answer by _osirisgothra_ Friday, November 23, 2012 5:19 PM
    • Unproposed as answer by _osirisgothra_ Friday, November 23, 2012 5:19 PM
    Monday, August 11, 2008 2:29 PM
  • Hi,

    Please don't move the Visual C++ runtime libraries to your debug directory, keep it in winsxs directory.

    Thanks!
    • Marked as answer by Yan-Fei Wei Sunday, August 17, 2008 11:51 PM
    Sunday, August 17, 2008 1:50 PM
  • i had this problem when turning off generate internal manifest in the linker, when it debugged it came to that same place. You are probably missing out on one of the manifests that are supposed to be generated but not at compile and is expected in your program. Im not sure about a workaround, and I can see the microsoft team is so helpful by giving the same auto-replies :)

    Its not a matter of moving the files around its just a matter of getting a project to work without all the bloat right? At least thats what I was going after.. or at least finding out why all the bloat was needed... apparently we are not supposed to know and get scolded when we try.


    Friday, November 23, 2012 5:04 PM
  • i have found a single to this:

    1) the before mentioned generation of your manifest, try renaming it from

    projname.exe.embed.manifest 

    to 

    projname.exe.manifest

    for me this caused the error x80000003 to go away... (even without all the dlls in my debug dir!)

    I think since the DLL msvcrXX0d.dll was compiled with _CRT_CHECK_MANIFEST, it might be impossible to get rid of manifests alltogether unless you plan on not using crt -- or using a non-microsoft library instead. (btw, XX= your version of the library, mines 9, but i think yours is 8) this I hope points you in the right direction....

    • Proposed as answer by _osirisgothra_ Friday, November 23, 2012 5:20 PM
    Friday, November 23, 2012 5:20 PM