linking error - not finding memcpy?
Has anybody else encountered the following linking error when building? I just cloned the repo and ran nmake, and things went fine until it started trying to link the .exe files (I pulled two, but they all failed the same way);
*** Linking echo
yecho.exe
yoricrt.lib(mem.obj) : error LNK2019: unresolved external symbol _memcpy referenced in function _mini_memcpy@12
yecho.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link.exe -nologo -incremental:no -OPT:REF -DEBUG -nodefaultlib -OPT:ICF -MACHINE:X86 -SUBSYSTEM:CONSOLE,5.1 -entry:ymainCRTStartup echo.obj ..\crt\yoricrt.lib ..\lib\yorilib.lib kernel32.lib ..\lib\yoriver.obj -version:2.40 /Pdb:yecho.pdb -out:yecho.exe' : return code '0x460'
Stop.
*** Linking edit
yedit.exe
yoricrt.lib(mem.obj) : error LNK2019: unresolved external symbol _memcpy referenced in function _mini_memcpy@12
yedit.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link.exe -nologo -incremental:no -OPT:REF -DEBUG -nodefaultlib -OPT:ICF -MACHINE:X86 -SUBSYSTEM:CONSOLE,5.1 -entry:ymainCRTStartup edit.obj options.obj ..\crt\yoricrt.lib ..\lib\yorilib.lib kernel32.lib ..\libwin\yoriwin.lib ..\libdlg\yoridlg.lib ..\lib\yoriver.obj -version:2.40 /Pdb:yedit.pdb -out:yedit.exe' : return code '0x460'
Stop.
Sorry for the delayed response. I pushed some fixes for this a while back. The real challenge is Visual C++ has code that detects C/C++ doing something that resembles a memcpy and replaces it with a function call, which makes it impossible to implement memcpy in C/C++. Its standard library implements this call in assembly, but I’d rather not include architecture specific implementations for every architecture.
I disabled optimizations around this block of code, which is unfortunate because it would benefit from common sense optimization, but can’t find a way to disable wholesale replacement of this code with a function call.