Exported functions and aliases

Started by Vortex, August 02, 2024, 09:27:03 PM

Previous topic - Next topic

Vortex

Hello,

Here is an example of exported functions with aliases.

ConsFuncs.def :

LIBRARY ConsFuncs
EXPORTS

"cls"=_ClearScreen@0
"WriteConsole"=_StdOut@4
StrLen
locate


Example code calling the functions :

.386
.model flat, stdcall
option casemap :none

ExitProcess PROTO :DWORD

includelib \PellesC\lib\Win\kernel32.lib
includelib ConsFuncs.lib

cls PROTO
WriteConsole    PROTO :DWORD
StrLen          PROTO :DWORD
locate          PROTO :DWORD,:DWORD

.data

message         db 'Hello world!',13,10
                db 'This is a console application.',13,10,0

.code

start:

    invoke  StrLen,ADDR message ; just for testing
    invoke  cls
    invoke  WriteConsole,ADDR message                                               
    invoke  ExitProcess,0

END start

Code it... That's all...