Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on April 03, 2024, 07:30:44 PM

Title: ALIAS sample
Post by: Vortex on April 03, 2024, 07:30:44 PM
Quick example to use the keyword ALIAS :

Code: [Select]
.386
.model flat,stdcall
option casemap:none

ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
OutputText PROTO C :DWORD,:VARARG

ALIAS "OutputText"="printf"

includelib  \PellesC\lib\Win\kernel32.lib
includelib  msvcrt.lib


DefStr MACRO id,str

.data

    id  db str
    db  0

    slen SIZESTR str

.code

ENDM


.data

msg db 'Lenght of the string = %u',0

.code

start:

    DefStr  string,"Hello world!"

    invoke  OutputText,ADDR msg,slen

    invoke  ExitProcess,0

END start