Page 1 of 2
Program works, exe doesnt?
Posted: Tue Aug 24, 2004 4:06 pm
by Moonshine
Ive written a program that uses DirectX 9. It works fine in the IDE and behaves as it should when I run it, but when I compile it to an exe, then try to run the exe I get an error (a messagebox that I defined in my code, so I know which bit is causing the problem.) What could be causing this? I dont really want to put my code up, but I can tell you that the Direct3D device creation is failing.
Like I say it works in the IDE but why not when executed seperately?
Posted: Tue Aug 24, 2004 4:11 pm
by GreenGiant
Only thing I can think is that maybe a DLL it needs isn't present in either the exe's folder or the system folder? One that is in the folder that the source is in maybe?
Posted: Tue Aug 24, 2004 4:15 pm
by upnorth
When running within the IDE, PureBasic creates a temporary executable in the Compiliers directory. Engine3D.dll is also in that directory. Perhaps you need to copy Engine3D.dll to the same directory as your final executable.
Posted: Tue Aug 24, 2004 4:34 pm
by Moonshine
Im not using the [OGRE] Engine3d.dll, Im writing a 3d engine myself.
Double checked with the D3Dspy9.dll which monitors what the application is doing - it calls the CreteDevice method but fails with a D3DERR_INVALIDCALL code. The definition of this error for this call is: "The method call is invalid. For example, a method's parameter may have an invalid value."
Oh how I wish Codemonger was here now
I just cant understand why this is happening - all of the required DLL's are present in the program folder - otherwise the program would fail much earlier when I open the libraries becuase I set up HandleError procedures to deal with any problems.
Posted: Tue Aug 24, 2004 5:25 pm
by GreenGiant
Hmm, cant think what the problem would be. I suppose the code is far too big to post? Clutching at straws here, but if you're using the OnError commands for your error handling did you remember to enable support for them in the compiler options?
Posted: Tue Aug 24, 2004 5:34 pm
by Moonshine
Checked it already. I used my own error handling procedures using the Win32 API. Ive been through the compiler options but I cant see anything that might cause a problem...
[edit] My main engine file had inline ASM support turned on so I turned it off and recompiled...no difference

Posted: Tue Aug 24, 2004 8:43 pm
by Moonshine
Another update and an informative discovery:
Turning the debugger off while in the IDE, then running the program, causes the same crash as the exe has - what does this mean? It didnt hit me until I was glancing through the menu then I remembered that the debugger isnt included with the compiled exe, yet Ive been using it to track down the bugs (damn helpful it has been aswell). So is this some kind ofconflict or what? Its really slowing me down (I'm on a roll at the moment), any help is appreciated

Posted: Tue Aug 24, 2004 8:51 pm
by filperj
Maybe (just an idea) you have something like:
If so, "ThatFunction()" will be called when debugger is on, not when it's off.
Posted: Tue Aug 24, 2004 8:54 pm
by Moonshine
Ive never used the debug command, so thats not it. Thanks for the suggestion though

Posted: Tue Aug 24, 2004 9:15 pm
by GedB
Moonshine,
Get the commented ASM for the debug and non-debug versions of the code and diff the two. I bet you'll find the problem in no time.
Posted: Tue Aug 24, 2004 9:18 pm
by Moonshine
Where is it exactly?
Posted: Tue Aug 24, 2004 11:45 pm
by GedB
If you compile from the command line with the /COMMENTED flag then a Purebasic.asm file will be created in the compiler directory. Just copy and rename that file to somewhere else.
If you know a bit of ASM then you'll find the commented file great. It clearly shows how each line of purebasic code has been compiled into ASM.
There is nothing quite like it for troublesheeting these tricky bugs.
http://www.purebasic.com/documentation/ ... piler.html
Posted: Tue Aug 24, 2004 11:51 pm
by Moonshine
Cheers, I'll check it out

Posted: Wed Aug 25, 2004 3:03 pm
by Moonshine
Well the .asm file never showed up, which was strange. I compiled with the /COMMENTED on the command line but there was no difference, there was no asm file. This is really confusing me.
Posted: Wed Aug 25, 2004 3:30 pm
by GedB
Are you looking in the purebasic\compilers directory for purebasic.asm.
It alwaysRegardless of the source or executable names and locations.