JLinX – Blog

Weblog von Jan Linxweiler

Delay Load CUDA Runtime Library DLL

Filed under: Development — Jannis at 6:29 pm on Monday, November 17, 2008

#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]

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.