Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Application crashes please help.

Application crashes please help.

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebuggingannouncement
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shivditya
    wrote on last edited by
    #1

    I am developing application which has to use third party dll,(for scanning)who only has described exported functions with function definition. After I developed a application,which gives proper result but it gives assertion in debug mode at each and every call of function imported from dll. Following is assertion. "The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention." And after completion of process (scanning) application terminates. I read articles from google,msdn and included __stdcall ,WINAPI ,combination but error comes as it is. In release mode assertion does not come.but application crashes everytime. I cannot debug it as application is terminating after passing end of function call. Only all it shows in debug is access violation and all binary code.

    || ART OF LIVING ||

    A W 2 Replies Last reply
    0
    • S shivditya

      I am developing application which has to use third party dll,(for scanning)who only has described exported functions with function definition. After I developed a application,which gives proper result but it gives assertion in debug mode at each and every call of function imported from dll. Following is assertion. "The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention." And after completion of process (scanning) application terminates. I read articles from google,msdn and included __stdcall ,WINAPI ,combination but error comes as it is. In release mode assertion does not come.but application crashes everytime. I cannot debug it as application is terminating after passing end of function call. Only all it shows in debug is access violation and all binary code.

      || ART OF LIVING ||

      A Offline
      A Offline
      Arun krishnan
      wrote on last edited by
      #2

      This normally happens when you are using a wrong version of the library for linking with the dll. If you have the source code for the dll try rebuilding the dll and rebuilding the application. Have you tried invoking the dll routines using LoadLibrary, and GetProcAddress. If the functions works perfectly using LoadLibrary calls, the problem is because of your wrong linking. Arun Krishnan

      1 Reply Last reply
      0
      • S shivditya

        I am developing application which has to use third party dll,(for scanning)who only has described exported functions with function definition. After I developed a application,which gives proper result but it gives assertion in debug mode at each and every call of function imported from dll. Following is assertion. "The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention." And after completion of process (scanning) application terminates. I read articles from google,msdn and included __stdcall ,WINAPI ,combination but error comes as it is. In release mode assertion does not come.but application crashes everytime. I cannot debug it as application is terminating after passing end of function call. Only all it shows in debug is access violation and all binary code.

        || ART OF LIVING ||

        W Offline
        W Offline
        Waldermort
        wrote on last edited by
        #3

        The "calling convention" refers to which end of the function call is responsible for cleaning the stack. From your error, it sounds like you are using the wrong call and the stack is not being cleaned correctly. An important thing to note here, when a function is called, a pointer is pushed onto the stack so that the function knows which part of the code to return to. If the stack is not cleaned correctly, this pointer is lost causing the function to return to an incorrect location, causing a crash. Read this[^] to get a better idea.

        S 1 Reply Last reply
        0
        • W Waldermort

          The "calling convention" refers to which end of the function call is responsible for cleaning the stack. From your error, it sounds like you are using the wrong call and the stack is not being cleaned correctly. An important thing to note here, when a function is called, a pointer is pushed onto the stack so that the function knows which part of the code to return to. If the stack is not cleaned correctly, this pointer is lost causing the function to return to an incorrect location, causing a crash. Read this[^] to get a better idea.

          S Offline
          S Offline
          shivditya
          wrote on last edited by
          #4

          I am not having source code of dll and no contact with writer of that dll. I also agree it is problem of calling convention. But what is solution for that. I tried allmost all __cdecl,__stdcall,WINAPI, something like __forcecall (not exact) .But it crashes after end of function.

          || ART OF LIVING ||

          W A 2 Replies Last reply
          0
          • S shivditya

            I am not having source code of dll and no contact with writer of that dll. I also agree it is problem of calling convention. But what is solution for that. I tried allmost all __cdecl,__stdcall,WINAPI, something like __forcecall (not exact) .But it crashes after end of function.

            || ART OF LIVING ||

            W Offline
            W Offline
            Waldermort
            wrote on last edited by
            #5

            Do you have the header file for the dll? If not then how do you know the function paramaters?

            1 Reply Last reply
            0
            • S shivditya

              I am not having source code of dll and no contact with writer of that dll. I also agree it is problem of calling convention. But what is solution for that. I tried allmost all __cdecl,__stdcall,WINAPI, something like __forcecall (not exact) .But it crashes after end of function.

              || ART OF LIVING ||

              A Offline
              A Offline
              Arun krishnan
              wrote on last edited by
              #6

              Try calling your function using LoadLibrary and verify the results. If the problem is because of calling convention or linkage, LoadLibrary call will be successful. I am not sure whether i am mis guiding you or not, but this is another alternative when you are stuck. Arun Krishnan

              S 1 Reply Last reply
              0
              • A Arun krishnan

                Try calling your function using LoadLibrary and verify the results. If the problem is because of calling convention or linkage, LoadLibrary call will be successful. I am not sure whether i am mis guiding you or not, but this is another alternative when you are stuck. Arun Krishnan

                S Offline
                S Offline
                shivditya
                wrote on last edited by
                #7

                Dear Friend I am not having .h file so I am loading it dynamically using LoadLibrary Only. I am having documentation of dll in which it is described the details of each functions ,what it does and its parameters. Even dll version number is also mentioned. so no chance of Mistake of parameters.

                || ART OF LIVING ||

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups