Search code examples
assemblyx86-64masmmasm64

source not found initsect.cpp


I am trying to learn Assembly(MASM x64) and wrote a simple code.

.code
main proc
mov rax, 1
mov rcx, 2
mov rdx, 0
div rcx
ret 0
main endp
end

Now I started a debugging process to see that it works(as there is no other way to check if something works) and at the line div rcx the debugger started to drag me the whole way through some files called exe_common.inl, file_mode.cpp, back to exe_common.inl, matherr.cpp, again back to exe_common.inl, utility.cpp,and again exe_common.inl(what are those???????). At that point, there is a block of preprocessor code

#ifdef _RTC
_RTC_Initialize();
atexit(_RTC_Terminate);
#endif

and at _RTC_Initialize(); (the second line), the programm shuts down with the message initsect.cpp not found. What on earth does that mean???? Stackoverflow shows a gloryous 0 results about 'initsect.cpp not found' and google is not helpful either. Obviously, the same thing always happens when the line with ret tries to execute. I have erased the 0 after ret, erased everything between main proc and main endp, and erased the ret line. always the same. This happens when the line before main endp tries to execute, no matter what it is. It even happens by the simplest code on the world:

.code
main proc
ret 0
main endp
end

I am using microsoft visual studio 2019 and a AMD x64-x86 CPU.


Solution

  • Ross Ridge was right, the assembler obviously linked the program with C runtime. What he forgot to say was that I need to set an entry point by _START: to avoid this, Thanks all of you for the help(ironical) and especially thank on DFpercush on Youtube(not ironical).