Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on August 02, 2024, 09:27:03 PM

Title: Exported functions and aliases
Post by: Vortex on August 02, 2024, 09:27:03 PM
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