Application crashes please help.
-
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 ||
-
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 ||
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
-
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 ||
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.
-
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.
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 ||
-
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 ||
Do you have the header file for the dll? If not then how do you know the function paramaters?
-
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 ||
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
-
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
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 ||