Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run application in Delphi debugger without recompiling?

Status
Not open for further replies.

RobNorthcott

Programmer
Feb 11, 2002
30
GB
I've got an error that happens on startup of a second instance of my app on the same machine. I thought I'd be able to get to the bottom of it by running one instance, then running the second one from inside Delphi, but it always tries to recompile the EXE file, which cannot be overwritten because the first instance is using it.

Is there a way to "run without recompile/link"?

BTW, I tried it with a separate copy of the EXE file for the first instance, but the error only seems to happen if both instances are using the same EXE.

Rob
 
I am not sure if your approach will help resolve the problem? There are several issues that you need to consider when allowing multiple copies of an Application to run together.

But Delphi wont let you run the application that the debugger is pointed at (i.e the one you have compiled previously in the IDE).
Hitting the Run button (or F9) should not attempt to recompile if you have made no changes, but it will check to see if the compile target is already running.
Have you tried copying the precompiled application to another location and running the copy?
I just tried it (D7) works fine.


Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
Thanks for the reply Steve.

Perhaps I should have given more background info:
The app has been running fine with nearly 500 customers for years (it's Delphi 5), with lots of them running multiple instances regularly.
Yesterday one of our installation technicians called in reporting the problem (not being able to run multiple instances) on a Windows 7 machine. He then said he'd seen the problem consistently on Vista machines (but hadn't thought it worth telling anybody about it...!)

I have now reproduced it on a Vista machine, but thought if I could run the second instance on the debugger it would help me narrow down the crash. Which is why I want to debug the code without recompiling (the first instance is already using the exe so it can't be overwritten and the compiler stops).

If I use a separate copy of the exe for each instance (even looking at the same data files) it doesn't crash, so doesn't help tracing the error.

It seems like it only happens on Vista and Win7 machines, never on XP or earlier.

The error is a BDE initialisation error, but I can't think why it should fail only when multiple instances are run from the same exe file (and then only on Vista and 7).

I appreciate the feedback anyway :)

Rob
 
try to run your application as administrator (elevated privileges) under vista to see if it makes a difference.

if the BDE is installed under the program files folder, then you are in trouble. (vista/W7 won't allow programs writing int the program files directory (or any system sensitive folder)

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Thanks Daddy,

The app is always run as an administrator user, otherwise it doesn't work at all under xp or later (it creates directories, which MS have decided a normal user is not allowed to do).

Not sure what you mean about the BDE being in the Program Files directory. The BDE is always installed there (program files\common\borland\bde... or similar), but the files for the app itself and its data can be anywhere - doesn't make any difference to this problem.

Rob
 
Right, managed to get to the bottom of this.
Just for anybody who comes across this thread in the future, the solution to my problem was as follows:
Managed to get it to come up with the BDE engine error codes, $2501 and $210D
Did some searching and the fix was to set the SHAREDMEMLOCATION in the BDE administrator (configuration\system\init) to 0x5BDE (it's empty by default). It seems the default value isn't happy on Vista and even less so on Win7.

But I'd still be interested if anybody knows a way to run a program under the debugger without overwriting the exe file (if it's indeed possible) - may be useful in future...

Thanks for your help.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top