-2

Delphi 2007 sometimmes holds a handle to the EXE it's linker makes. Sometimes it works fine. But other times it's a whole day saying: "Cannot make EXE file" or something similar when trying to compile or build a solution.

When I try to launch EXE made from Delphi it says that another process is holding the file. Going to "unlocker" says: bds.exe. Even if I unlock it I must rename it to eg. app1.ex_ and copy it back to app1.exe. But still Delphi is holding the handle to that .ex_ file.

Needless to say it makes debugging (or even running) and developing quite slow: having to deal with locked exe...

Any suggestion? Workaroung or fix available - I've been looking for it but can seem to find it: I'm sure others have the same problems (I've seen it) - is there any fix for this?

env.: Win7 Ent. x64, Delphi CodeGear 2007

Thanks!

  • Restarting Delphi each time is not an option - because it takes a long time (quite a big project). Also seen solutions with Win "Application Experience" and indexing disabled on that folder: does not work for me. it's described here if someone finds it usefull: [fatal-error-cannot-create-output-file-project1-exe](http://stackoverflow.com/questions/11851318/fatal-error-cannot-create-output-file-project1-exe) – Maksi Ubana Oct 14 '14 at 06:02
  • 1
    Something like this ? [Fatal Error: Cannot create output file “project1.exe”](http://stackoverflow.com/questions/11851318/fatal-error-cannot-create-output-file-project1-exe) – bummi Oct 14 '14 at 06:06
  • Restart Delphi. What else are you going to do? You could ask CodeGear to release an update. But surely you realise that's futile. – David Heffernan Oct 14 '14 at 06:33
  • @bummi1 - Pls, read all text befor reply: I said "App..Expirence" solution mentioned in 'your' link does not work. I'm aware of that thread, thank you - I posted same link: but it does not work for me. Btw: thank you for the downvote... I guess...? and: why did you post the same link? – Maksi Ubana Oct 14 '14 at 07:13
  • @David - yeah restart is (sometimes) a solution, but it takes time and it's not a guarantee: it can become locked again after linking. I asked for community fix, or workaround. Of course I do not expect CodeGear to fix it :)... There is similar solution to debugger: "Assertion failure": [here](http://martinvirgil.wordpress.com/2012/09/05/delphi-assertion-failure-using-windows-7-64bit/) if somebody find it useful. anyway thanks. still looking... – Maksi Ubana Oct 14 '14 at 07:20
  • 1
    You could also check if it's related to your antivirus – David Heffernan Oct 14 '14 at 07:23

1 Answers1

0

Going to "unlocker" says: bds.exe. Even if I unlock it I must rename it to eg. app1.ex_ and copy it back to app1.exe. But still Delphi is holding the handle to that .ex_ file.

Based on the fact that renaming file causes the BDS.exe to "hold the lock" of renamed file I seriously doubt the BDS.exe is actually the one that is holding the lock. If BDS would be holding the lock on that file you wouldn't even be able to rename it.

So I would seriously suspect that your AntiVirus software might be behind it.
I even remeber having similar difficulties years back using Delphi 7. The cause then was ma AntiVirus software (Nod32 version 2). First workaround I was unsing was to simply delete the application exe file prior compiling, but later I simply added entire Folder into the AV residental protection ignore list.

So try adding your project folder into ignore list and see if it solves the problem.

SilverWarior
  • 5,651
  • 2
  • 13
  • 19
  • thanks for reply: "If BDS would be holding the lock on that file you wouldn't even be able to rename it."....emm: Unlocker does that: rename the file. Or just unlocks bds.exe and I can do it via cmd: rename... I'll try with AV. – Maksi Ubana Oct 14 '14 at 08:40
  • " If BDS would be holding the lock on that file you wouldn't even be able to rename it." I actually can't do that: e.i.rename without using "system" tool like Unlocker, which points to bds.exe... – Maksi Ubana Oct 14 '14 at 11:58
  • Are you able to delete the file without the using of "unlocker"? – SilverWarior Oct 15 '14 at 11:42
  • @SilverWarrior: thanks for reply. Nope. And it always pointed to bds.exe. AV: shut down - same thing. – Maksi Ubana Oct 15 '14 at 12:47
  • >>So try adding your project folder into ignore list and see if it solves the problem.<< As mentioned above:no. – Maksi Ubana Oct 16 '14 at 06:36
  • Well at this time I'm not sure on how to proced in finding the real problem. IS this ocuring with all of your projects or just with this specific one. If it is just with this specific one then something in ypur application is causing unexpected behavior. Maybe it wouldn't hurt to heck if the windows DEP (date execution prevention) system might not be interfering with proper shutdown of your application. It is posible that Windows DEP might even be interfering with the peoper working of Delphi debugger. At this time I don't have anything else to suggest. – SilverWarior Oct 16 '14 at 22:50
  • @SilverWarrior: thanks! It happens "random"-ly with all projects. Can't find the "trigger"/pattern. AV off,... and it's always bds.exe thats holding the file. I guess Delphi restart is still the 'best' solution. I tried IDEFix.. pack: but I don't think it addresses this issue. – Maksi Ubana Oct 27 '14 at 12:31