undefined reference to `memcpy'?
Posted: Sun Jan 31, 2016 10:35 pm
Edit: Solved.
Edit: Not Solved, I was in debug mode.:
Hi all, I am not sure why this error is displayed.
I have memcpy in my program as below.
This error happens in the following code, using the struct.
If I switch the commented lines below it works fine.
For some reason when optimization is full it cannot find memcpy.
This works.But this does not
Edit: Not Solved, I was in debug mode.:
Hi all, I am not sure why this error is displayed.
I have memcpy in my program as below.
Code: Select all
extern "C" void* memcpy(void *dest, const void *src, size_t len);
Code: Select all
template<QWORD Size> struct QuickCopy
{
BYTE Data[Size];
static FIL void Copy(QWORD Destination, QWORD Source);
static FIL void Copy(void* Destination, void* Source);
};
Code: Select all
template<QWORD Size> void QuickCopy<Size>::Copy(QWORD Destination, QWORD Source)
{
//memcpy((void*)Destination, (void*)Source, Size);
*(QuickCopy<Size>*)Destination = *(QuickCopy<Size>*)Source;
}
template<QWORD Size> void QuickCopy<Size>::Copy(void* Destination, void* Source)
{
//memcpy((void*)Destination, (void*)Source, Size);
*(QuickCopy<Size>*)Destination = *(QuickCopy<Size>*)Source;
}
This works.
Code: Select all
QuickCopy<2048>::Copy(1, 0x12345687);
Code: Select all
QuickCopy<(QWORD)sizeof(TestCode)>::Copy((QWORD)Account->Code, (QWORD)&TestCode[0]);