Karthik Rao
Karthik Rao

Reputation: 23

C++ error: 'No suitable conversion function from [class name] to “void *"

I am trying to copy 2 arrays since the conventional method of copying is not giving me the updated value. So I am trying via the memcpy method

ret_t ifxPkc:: regSCM0ReadCB(uint32 idx,tlm::tlm_generic_payload& p)
{

    memcpy(scmr0Reg_,scMem, sizeof(scmr0Reg_));

    return scmr0Reg_[idx].read(p);
}

This is a callback function. Here the idx is incremented for every call by another piece of code.

scmr0Reg_ belongs to IfxPkcScmR0Register class. Further, IfxPkcScmR0Register belongs to

class IfxPkcScmR0Register : public SC_BSX::IdxReg32

On using in the above format I get the error -

C++ error: 'No suitable conversion function from [class name] to “void *"

Can I get help on how do I need to use it in memcpy function ?

Thanks.

Upvotes: 0

Views: 3484

Answers (1)

dmi
dmi

Reputation: 1479

memcpy takes pointers as first two parameters. Since it is not obvious from your code what are the data types of scmr0Reg_ and scMem, I assume they are some objects. In this case you need to pass pointers to them as memcpy(&scmr0Reg_, &scMem...

Upvotes: 2

Related Questions