Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Release mode crash

Author
Message
Flatbattery
15
Years of Service
User Offline
Joined: 2nd May 2009
Location: Brum, UK
Posted: 14th May 2009 01:32 Edited at: 14th May 2009 23:55
Noob needs help!
When any of these functions are called in release mode my application hangs or crashes,but works fine in debug mode. Apologies for any poor coding only been at it a few weeks.

Any help will be much appreciated.

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 14th May 2009 21:43 Edited at: 14th May 2009 21:52
Could you post your entire code? I tried compiling the code that you posted in release mode. I didn't receive any problems.

If you received any error messages, please post the actual, entire message.

EDIT: Nevermind. I did a proper test. Your program does exactly what you said it does. I will try to work it out.
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 14th May 2009 22:43 Edited at: 14th May 2009 22:56
Yeah I figured it out. It is a weird glitch. To solve it, you need to declare a "won't be used" variable in the DarkGDK function.



I called this variable Decoy. You can call it whatever you like. Make sure that the variable WON'T be used! Another thing! Make sure that other variables, arrays, etc declared INSIDE the DarkGDK function is NOT declared ABOVE the "won't be used" variable! The three dots above and below the declaration just represent other code that you can put there.
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 14th May 2009 22:56 Edited at: 15th May 2009 16:23
WH8 that doesn't make sense

The code shown below causes an access violation:


This is becuase you cant have object 0, only object 1. Changing the code to this fixes the problem:



Same with the delmusic, delimage and delall functions

Fixed code:



For some reason when built in debug mode it doesn't pick up this error

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 14th May 2009 23:00 Edited at: 14th May 2009 23:02
I know it doesn't make sense. I had to add a Decoy variable into my code as well because I was experiencing weird problems. When I added the variable, the problem went away!

My above solution does work. If you do not believe me, please try running a compiled release program that calls the author's functions. You will experience a problem. After adding the Decoy variable, the problem will be gone.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 14th May 2009 23:00
If it's release and not debug, isn't it more likely to be the libraries included rather than the code itself?

Flatbattery
15
Years of Service
User Offline
Joined: 2nd May 2009
Location: Brum, UK
Posted: 14th May 2009 23:30
Thanks everybody, it seems all the advice here has solved my problem.

Hopefully over time I might be able to cope better with this kind of thing.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 15th May 2009 13:37 Edited at: 15th May 2009 13:39
One minor thing: The function is defined as the type void, and therefore it should return nothing, not zero.

Really minor detail, but it's a matter of consistency.

EDIT: I see what you did there. I was under the impression it was all wrapped within a function, because of the lack of indentation. That's really more than a minor problem.


My site, for various stuff that I make.

Login to post a reply

Server time is: 2024-10-01 01:27:32
Your offset time is: 2024-10-01 01:27:32