Program works, exe doesnt?

Everything else that doesn't fall into one of the other PB categories.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Program works, exe doesnt?

Post 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?
Mark my words, when you least expect it, your uppance will come...
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post 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?
upnorth
User
User
Posts: 18
Joined: Wed Jul 21, 2004 8:54 pm
Location: California, USA

Post 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.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post 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.
Mark my words, when you least expect it, your uppance will come...
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post 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?
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post 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 :cry:
Mark my words, when you least expect it, your uppance will come...
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post 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 :)
Mark my words, when you least expect it, your uppance will come...
filperj
User
User
Posts: 77
Joined: Tue Sep 16, 2003 8:53 pm
Location: Nevers(France)

Post by filperj »

Maybe (just an idea) you have something like:

Code: Select all

 Debug ThatFunction() 
If so, "ThatFunction()" will be called when debugger is on, not when it's off.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Ive never used the debug command, so thats not it. Thanks for the suggestion though :)
Mark my words, when you least expect it, your uppance will come...
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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.
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Where is it exactly?
Mark my words, when you least expect it, your uppance will come...
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post by Moonshine »

Cheers, I'll check it out :)
Mark my words, when you least expect it, your uppance will come...
Moonshine
Enthusiast
Enthusiast
Posts: 263
Joined: Tue May 25, 2004 12:13 am
Location: UK

Post 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.
Mark my words, when you least expect it, your uppance will come...
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Are you looking in the purebasic\compilers directory for purebasic.asm.

It alwaysRegardless of the source or executable names and locations.
Post Reply