External calls are not supported (found non-inlined call to memInit)

Have a little Error here I cant figure out where it comes from:

External calls are not supported (found non-inlined call to memInit)

The source code is the following:

__global__ void doSHA(unsigned char * input, int length)

{

        unsigned long tmp[16];

        memInit(tmp, input, length);    

}

__device__ void memInit(unsigned char * tmp, unsigned char * input, int length)

{

        int stop = 0;

        // reseting tmp

        for(int i = 0; i < 16; i++) tmp[i] = 0;

// fill tmp like: message char c0,c1,c2,...,cn,10000000,00...000

        for(int i = 0; i < length; i+=4)

        {

            for(int j = 0; j < 4; j++)

                if(i + j < length)

                    tmp[i/4] |= input[i+j] << (24 - j * 8);

                else

                {

                    tmp[i/4] |= 128;    // Append 1 then zeros

                    stop = 1;

                    break;

                }

        if(stop)

            break;

        }

// Adding length as last value

        tmp[15] |= length;

}

Ty for your help!

You have defined this:

__device__ void memInit(unsigned char * tmp, unsigned char * input, int length)

but you are calling this:

__device__ void memInit(unsigned long tmp[], unsigned char * input, int length)

Device code is compiled using C++ semantics and those two functions are not the same. So this leads the compiler to assume that what you are calling must be defined outside the current compilation unit, and because device code does not support external linkage, it therefore concludes that you are trying to call an externally defined host function in your device code. This is illegal and results in the compiler error you see being emitted.