adds example for calling external C func from masm
This commit is contained in:
parent
94878a596c
commit
6cccbf0a18
|
@ -10,4 +10,6 @@ main proc ; the main procedure
|
||||||
call asm_proc ; call our proc
|
call asm_proc ; call our proc
|
||||||
ret
|
ret
|
||||||
main endp
|
main endp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
option casemap:none
|
||||||
|
|
||||||
|
.data
|
||||||
|
|
||||||
|
fmt_str byte 'Hello World!', 10, 0 ; here 10 is the newline feed
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
externdef printf:proc
|
||||||
|
|
||||||
|
public asm_func
|
||||||
|
|
||||||
|
asm_func proc
|
||||||
|
sub rsp, 56
|
||||||
|
lea rcx, fmt_str ; load the format string into the RCX register to be used by the printf
|
||||||
|
call printf
|
||||||
|
add rsp, 56
|
||||||
|
ret
|
||||||
|
asm_func endp
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue