More trouble understanding output from the error reporting stuff..
My little application is crashing - I get this from the error reporting functions :
Error Number: -1073741819
Module: C:\myapp_main.pb
Description: An attemped read or write to/from an address to which that process isn't allowed
Line Number: 619
I read that the line numbers are off by one, which means it's crashing on the ProceduReturn call. Why would that happen? I'm calling some functions in a 3rd party DLL in that procedure but I've done the same in several other apps without causing a crash and I literally cut/paste the code from the working app into this (and checked it!).
can you put a messagerequester() before the procedurereturn to confirm that bug (not that the bug happen in the dll-Call )
and some hints:
Often DLL-Calls needs Pointers to variables(By Reference) not the variable itself(ByValue) .important , else it will crash with the same error you get.
I have had a similar problem many of times calling d3dx9.dll ... It drove me nuts, literally crazy. If it is any consilations here is what I found, this doesn't relate directly to your problem, but ...
If my code was in the main dll, it would not crash the program
It would only crash if it is in a procedure
Anyway I found the problem being that the dll is actually has some functinons tagged with a "A" at the end or a "W" for unicode compatibility.
----------------------------------
Anyways the point being the functions I was calling actually did not exist for example I would call
d3dxcoloradd()
i would get an error only in the procedure. but that function does not actually exist, I would have to call:
d3dxcoloraddA()
----------------------------------
The workaround I came up with, but haven't implemented was creating an empty dll, for the LIB file and only including the Functions I needed and in the DEF file give a different name for the functions that I needed such as
d3dxcoloradd = d3dxcoloraddA
So I don't know if this helps, but it may help with ideas for a possible solution, or it may help someone else having similar problems.
I'm sure that the crash isn't happening inside the DLL as I can put any number of debug or messagrerequesters before the procedure returns and I see them. It seems to crash when the procedure returns (and I've changed the return type to everything with nothing helping the situation..)
I've used the DLL in question before in another application with no problems too..
This sounds like something messed up the stack. On ProcedureReturn, the
program get's the address where to jump back from the stack, and jump's
there. If there is now a wrong value on the stack (for example a variable)
the program tries to jump to a non-code area, this could produce this error.
Are you sure, you call the dll with the right number of arguments?
Is it maybe a CDECL library? (would require CallFunctionC())