4

How can I disable file locking in windows, so that locked files can be overwritten as in linux systems?

I am developing a plugin, which is a dll. Before compiling it again, i always need to unload it in the program, which loaded it. It would reduce the work a lot, if I could compile it always and just reload it later by unloading / loading again. With linux this is no problem, the compiler just overrides the plugin and when it's opened the next time the new version will be used. Windows has a write lock on it, so the compiler cannot write it and aborts.

1 Answer 1

4

You cannot "just" disable locking of executable/library files.

However, you can move or rename in-use files, so make your build process move the existing DLL elsewhere and compile the new one in its place.


It's very possible that they didn't add a hidden switch for it because various parts of the OS assume it'll always be on. For example, it could be that the filesystem code expects that there's always at least one link to a file (and therefore space can be freed immediately after deleting that last link) – so if you force it to delete an in-use file, it might result in various kinds of filesystem corruption, like two files using the same disk space.

That said, The Old New Thing has once written that it actually wouldn't be hard to allow Linux-style file deletion in the WinNT kernel, and that they just haven't done so to avoid some compatibility issues.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .