libc.obj: Update fasm sample for auto load & linking

git-svn-id: svn://kolibrios.org@9718 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Coldy 2022-02-15 16:43:51 +00:00
parent 143d7b8027
commit d37b797def

View File

@ -1,9 +1,12 @@
; 2022, Edited by Coldy
; Added changes for auto load & linking
format binary as "kex" format binary as "kex"
use32 use32
org 0x0 org 0x0
db 'MENUET01' db 'MENUET01'
dd 0x01 dd 0x02 ; 2 - for enable autoload feature
dd START dd START
dd IM_END dd IM_END
dd MEM dd MEM
@ -11,19 +14,34 @@ use32
dd 0 dd 0
dd 0 dd 0
include '../../../../../macros.inc' ; { Begin of KX header (this need for recognition by dll.obj)
include '../../../../../proc32.inc'
include '../../../../../KOSfuncs.inc' db 'KX',0 ; Signature/Magic
include '../../../../../dll.inc' db 0 ; Revision
db 1000000b ; Flags0 (user app w/import)
db 0 ; Flags1
dw 0 ; Reserved
dd @IMPORT ; Pointer to import table
; } End of KX header
include '../../../../../../macros.inc'
include '../../../../../../proc32.inc'
include '../../../../../../KOSfuncs.inc'
; no needed for autolod
;include '../../../../../dll.inc'
;include '../../../../../debug-fdo.inc' ;include '../../../../../debug-fdo.inc'
;__DEBUG__ = 1 ;__DEBUG__ = 1
;__DEBUG_LEVEL__ = 2 ;__DEBUG_LEVEL__ = 2
START: START:
stdcall dll.Load, @IMPORT ; Disabled, dll.obj doing this
test eax, eax ;stdcall dll.Load, @IMPORT
jnz exit ;test eax, eax
;jnz exit
cinvoke libc_strlen, test_str1 cinvoke libc_strlen, test_str1
;DEBUGF 2, "%d", eax ;DEBUGF 2, "%d", eax
@ -49,7 +67,8 @@ print_fail:
exit: exit:
mcall SF_SYS_MISC, SSF_MEM_FREE, [test_str2] mcall SF_SYS_MISC, SSF_MEM_FREE, [test_str2]
mcall SF_TERMINATE_PROCESS //mcall SF_TERMINATE_PROCESS - disabled, dll.obj also doing this
ret
; data ; data