Compilation learning environment to build windows

MASM32 is a good compilation of IDE, but there is ml.exe and link.exe too old. So I direct the ml.exe and link.exe visual studio 2019 inside the band.

Since Science compiled, using the IDE inconvenient, not as a direct operation in cmd window,

 

MASM32 and install visual studio 2019, and then in the computer environment variable to add environment variables,

include variable is masm32 folder location which include header files,

lib variables are variables that position masm32 lib folder inside the file,

Compile and link time, ml.exe and link.exe need to find the location of these files.

Path inside which added visual studio 2019, x86 folder location inside ml.exe and link.exe files.

After the completion of setting environment variables, you can use the command CMD window inside ml compiled assembly file, use the link to the linked file.

I do not know why there is no post-lib variable is set to take effect at link time still you need to manually specify the location lib file.

    . 386 
    .model Flat, stdcall 
    the Option casemap: none 
     
    . The include Windows INC. 
    . The include user32 INC. 
    . The include kernel32 INC. 
    Includelib USER32.LIB 
    includelib kernel32.lib 
     
    .data 
    szCaption db ' Duke56 ' , 0 
    szText db ' the Hello World! ' , 0 
     
    . code 
    Start: 
        the invoke MessageBox, \     ; call the function name 
        NULL, \             ; parent window handle 
        offset szText, \        ; Text 
        offset szCaption, \     ; title 
        MB_OK             ; button type 
     
        the Invoke ExitProcess, NULL 
    End Start

The above code such as Notepad test.asm saved as a file.

Then in the CMD window, enter the directory test.asm files,

Use "ml / c / coff test.asm" compiled into test.obj test.asm file,

Then use the "link / subsystem: windows / libpath: e: \ masm32 \ lib test.obj",

After the link to become test.exe file.

Guess you like

Origin www.cnblogs.com/alhope/p/11765331.html