It works when running from C::B because the lib location is (temporarily) added to your PATH. Either copy the DLL to the output folder of your executable (you can add a post-build step that does that in the project build options), or add the folder with the DLL to the system PATH yourself (less dirty than copying it to the system folder). Personally, I prefer the first option.