Program works, exe doesnt?
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Put this in your code somewhere
Moonshine wrote:Cheers, I'll check it out
Code: Select all
;-; Global error handler, very 1st line (Danilo's suggestion)
OnErrorGoto(?ErrorHandler)
Code: Select all
;-; Danilo's suggestion to trap some errors occuring
ErrorHandler:
Module.s = GetErrorModuleName()
Errnum.s = StrU(GetErrorLineNR(), #LONG)
MessageRequester("FATAL ERROR", "There is an error in " + Module.s + ", at line " + Errnum.s, #MB_ICONERROR)
End
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
I got an "Error in Main Module at line 0". And to see if it was just my code, I took one of codemongers old DX9 examples ("VertexBuffer") and swapped his include files for mine. The app did the same, it just quit before ithad started. This makes me think that its a compiler bug rather than a coding error, as I seem to have tried everything I know. I might consider either a)uninstalling the current one (v3.91, updated from 3.90), then installing 3.90 and compiling, or b)downloading the complete 3.91 installer and trying that, although it shouldnt really make a difference.
Mark my words, when you least expect it, your uppance will come...
I'll try with linenumbering. Anyways, heres something new - I used the DirectX debug output utility to monitor just what was going on ... this is what it said
*Note - only the first bit appeared during runtime (the PresentationInterval part, which is set perfectly fine to my knowledge), the rest bout memory appeared when I closed the program.
Update: Memory allocation problems fixed (already, 12 minutes after posting) 
*Note - only the first bit appeared during runtime (the PresentationInterval part, which is set perfectly fine to my knowledge), the rest bout memory appeared when I closed the program.
Code: Select all
2792: Direct3D9: (ERROR) :Invalid value for PresentationInterval. ValidatePresentParameters fails.
2792: Direct3D9: (ERROR) :Memory still allocated! Alloc count = 4
2792: Direct3D9: (ERROR) :Current Process (pid) = 00000ae8
2792: Direct3D9: (ERROR) :Memory Address: 00b738cc lAllocID=1 dwSize=000047f8, R
eturnAddr=009a3796 (pid=00000ae8)
2792: Direct3D9: (ERROR) :Memory Address: 00b7a75c lAllocID=9 dwSize=0000180c, R
eturnAddr=0099e1e9 (pid=00000ae8)
2792: Direct3D9: (ERROR) :Memory Address: 00b7bf8c lAllocID=10 dwSize=00000008,
ReturnAddr=0099e289 (pid=00000ae8)
2792: Direct3D9: (ERROR) :Memory Address: 00b7bfbc lAllocID=11 dwSize=000009c0,
ReturnAddr=009a2f45 (pid=00000ae8)
2792: Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 27084 bytes

Mark my words, when you least expect it, your uppance will come...
PRAISE THE GOOD LORD!!! Ive done it!!!! 
You will not believe how simple it was.
Right, for anything to be presented to the screen or a window with D3D, and to create a rendering device, you must first fill a structure called D3DPRESENT_PARAMETERS. Well the failure I was getting was that PresentationInterval (the last member of the D3DPRESENT_PARAMETERS structure) was invalid, even though i knew it wasnt. So my thought was that it had something to do with the structure itself - I didnt think it mattered, but theres 2 members of the structure (Windowed, and EnableAutoDepthStencil) that are booleans in the actual C++ structure. So I thought it might be a better idea to set them to byte rather than long. This must have caused an error with the size of the structure which made the last member invalid.
As a long shot I set the two from .b to .l and voila! Instant compile without the debugger!
Just goes to show how much difference a few bytes can make. Well, I hope we can all learn something from this! Massive thanks to everyone who has provided suggestions and help

You will not believe how simple it was.
Right, for anything to be presented to the screen or a window with D3D, and to create a rendering device, you must first fill a structure called D3DPRESENT_PARAMETERS. Well the failure I was getting was that PresentationInterval (the last member of the D3DPRESENT_PARAMETERS structure) was invalid, even though i knew it wasnt. So my thought was that it had something to do with the structure itself - I didnt think it mattered, but theres 2 members of the structure (Windowed, and EnableAutoDepthStencil) that are booleans in the actual C++ structure. So I thought it might be a better idea to set them to byte rather than long. This must have caused an error with the size of the structure which made the last member invalid.
As a long shot I set the two from .b to .l and voila! Instant compile without the debugger!
Just goes to show how much difference a few bytes can make. Well, I hope we can all learn something from this! Massive thanks to everyone who has provided suggestions and help

Mark my words, when you least expect it, your uppance will come...