Page 1 of 1

Error reporting problems

Posted: Mon Nov 17, 2003 9:34 pm
by Karbon
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
Here is line 619 and 620 :

Code: Select all

  ProcedureReturn 1
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!).

Get out the clue sticks boys!

Thanks!

Posted: Tue Nov 18, 2003 9:40 am
by Rings
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.

Posted: Tue Nov 18, 2003 2:04 pm
by Codemonger
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.

Posted: Tue Nov 18, 2003 4:28 pm
by Karbon
Thanks for the replies guys!

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..

Grrrr... *gets out big hammer*

Posted: Tue Nov 18, 2003 4:46 pm
by freak
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())

Just some thoughts...

Timo

Posted: Tue Nov 18, 2003 5:19 pm
by Karbon
Son of a.... That's exactly what it was freak. Why the hell didn't I think of trying that?

The reason it was working before was that the calls weren't in a procedure.. Geeeeeeeeeeeeze.

Couldn't see the forest for the trees...

THANKS!