Delay Load CUDA Runtime Library DLL
#include < windows.h>
#include <delayimp.h>
int cudaDetect()
{
// Try to load imports from NVIDIA runtime DLL
// If this is not possible then there’s no compatible driver installed
__try
{
if( FAILED( __HrLoadAllImportsForDll( “cudart.dll” ) ) )
return 0;
}
__except( EXCEPTION_EXECUTE_HANDLER )
{
return 0;
}
return 1;
}
- Add “/DELAYLOAD:cudart.dll” to linker command line
- Add Dependency to “delayimp.lib”
[tags]: CUDA, C++, Windows, Development[/tags]
Comments Off on Delay Load CUDA Runtime Library DLL