SetDllDirectory fails with error code 183 ("Cannot create a file when that file already exists")

302 Views Asked by At

We're working on a Visual Studio plugin and for that we created a dll with some new functionality. Then we call SetDllDirectory to add our installation path to the dll search path, and we get error code 183 which means "Cannot create a file when that file already exists". We know for sure this is the problematic call as we have a logger activated. The path we add is valid and exists on the machine we launch VS on.

Any idea what could be cause this? We found no such reference on the web...

Thanks, Oren

1

There are 1 best solutions below

0
On

Well - we were wrong :-)

SetDllDirectory returns 0 for failure, so our check was wrong. Any value which is not 0 is OK and is used for information purposes.

Oren