calling a host function from a __device__ error

I am porting the following code


device void SHA1_Create(PSHA1CTX pCtx)
{

SHA1_Initialize(pCtx);

return;

}

device void SHA1_Initialize(PSHA1CTX pCtx)
{
// init the digest
SHA1_Reset(pCtx);

// set the bit counter to zero
 pCtx->lCountLo = pCtx->lCountHi = 0;

}

device void SHA1_Reset
(PSHA1CTX pCtx)
{


And I am getting the following compilation error code in visual studio:

Performing Custom Build Step
“.\duplicate_kernel.cu”, line 257: error: calling a host function from a
device/global function is only allowed in device emulation
mode
SHA1_Initialize(pCtx);
^
“.\duplicate_kernel.cu”, line 266: error: calling a host function from a
device/global function is only allowed in device emulation
mode
SHA1_Reset(pCtx);
^


As you can see both functions are declared as device, so I am not sure what the error code means. Any suggestions?

See if you can reduce the case to a small self-contained .cu file that causes the compiler message and post it here (or send it to me as an attachment). Ideally, one would only need to type “nvcc bug.cu” to see the behavior.

Paulius