Code: Select all
Procedure.l A(a.l,b.l)
ProcedureReturn a + b
EndProcedure
; IDE Options = PureBasic 4.40 (Windows - x86)
; CursorPosition = 12
; Folding = -
; EnableThread
; EnableAdmin
pbcompiler.exe Test.pb /DYNAMICCPU /THREAD /ADMINISTRATOR /COMMENTED /EXE
Code: Select all
;
; PureBasic 4.40 (Windows - x86) generated code
;
; (c) 2009 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; :System
; KERNEL32
; :Import
;
format MS COFF
;
extrn _ExitProcess@4
extrn _GetModuleHandleA@4
extrn _HeapCreate@12
extrn _HeapDestroy@4
;
extrn _memset
extrn _SYS_InitString@0
;
extrn _SYS_GetStringBase@0
extrn _SYS_GetStringBasePointer@0
extrn _SYS_GetStringBaseNoResult@0
extrn _SYS_GetStringBasePosition@0
extrn _SYS_SetStringBasePosition@4
extrn _SYS_RestoreStringBasePosition@4
extrn _SYS_IncrementStringBasePosition@0
public _PB_Instance
public _PB_ExecutableType
public _PB_MemoryBase
public PB_Instance
public PB_MemoryBase
public _PB_EndFunctions
macro pb_public symbol
{
public _#symbol
public symbol
_#symbol:
symbol:
}
macro pb_align value { rb (value-1) - ($-_PB_DataSection + value-1) mod value }
macro pb_bssalign value { rb (value-1) - ($-_PB_BSSSection + value-1) mod value }
extrn SYS_CpuID
public PureBasicStart
;
section '.code' code readable executable align 8
;
;
PureBasicStart:
;
PUSH dword I_BSSEnd-I_BSSStart
PUSH dword 0
PUSH dword I_BSSStart
CALL _memset
ADD esp,12
PUSH dword 0
CALL _GetModuleHandleA@4
MOV [_PB_Instance],eax
PUSH dword 0
PUSH dword 4096
PUSH dword 0
CALL _HeapCreate@12
MOV [PB_MemoryBase],eax
CALL SYS_CpuID
;
CALL _SYS_InitString@0
;
; Procedure.l A(a.l,b.l)
macro MP0{
_Procedure0:
PUSH ebx
PS0=8
; ProcedureReturn a + b
MOV ebx,dword [esp+PS0+0]
ADD ebx,dword [esp+PS0+4]
MOV eax,ebx
JMP _EndProcedure1
; EndProcedure
XOR eax,eax
_EndProcedure1:
POP ebx
RET 8
}
_PB_EOP_NoValue:
PUSH dword 0
_PB_EOP:
CALL _PB_EndFunctions
PUSH dword [PB_MemoryBase]
CALL _HeapDestroy@4
CALL _ExitProcess@4
_PB_EndFunctions:
RET
;
;
section '.data' data readable writeable
;
_PB_DataSection:
pb_public PB_DEBUGGER_LineNumber
dd -1
pb_public PB_DEBUGGER_IncludedFiles
dd 0
pb_public PB_DEBUGGER_FileName
db 0
_PB_ExecutableType: dd 0
;
; Dynamic functions jump table
;
public _SYS_StaticStringStart
_SYS_StaticStringStart:
pb_public PB_NullString
db 0
public _SYS_StaticStringEnd
_SYS_StaticStringEnd:
align 4
align 4
s_s:
dd 0
dd -1
align 4
;
section '.bss' readable writeable
_PB_BSSSection:
align 4
;
I_BSSStart:
_PB_MemoryBase:
PB_MemoryBase: rd 1
_PB_Instance:
PB_Instance: rd 1
;
align 4
PB_DataPointer rd 1
align 4
align 4
align 4
align 4
I_BSSEnd:
section '.data' data readable writeable
SYS_EndDataSection:
I would like to create an EXE with the export functions.
How can we modify the Test.Asm file export functions? Thank you.
I would use the
pbcompiler.exe Test.asm /DYNAMICCPU /THREAD /ADMINISTRATOR /REASM /EXE
Command to compile the file.
This method in C + +, just use.
#pragma comment(linker, "/EXPORT:_A,@1,NONAME")