Error reporting problems

Everything else that doesn't fall into one of the other PB categories.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Error reporting problems

Post 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!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post 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.
SPAMINATOR NR.1
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post 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.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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*
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
freak
PureBasic Team
PureBasic Team
Posts: 5946
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply