It is currently Tue Oct 24, 2017 1:34 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: how to create a userlibrary?
PostPosted: Sun Oct 08, 2017 6:41 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Fri Apr 25, 2003 6:41 pm
Posts: 1355
On windows it is easy. start fasm with the parameter "source.asm dest.obj", create a desc-file and use librarymaker.exe

But MacOs use yasm - and i have no idea, which parameter i should use?
i tried "-a x86 -m amd64 -f macho -o dest.o source.asm"

but i get a assembler-error, when i try to use the userlibrary "purebasic.asm: error: undefined symbol ..."

asmfile:
Code:
;
; PureBasic 5.61 (MacOS X - x64) - generated code
;
; (c) 2016 Fantaisie Software
;
; The header must remain intact for Re-Assembly
;
; Internal
; :System
; :Import
;
default rel
;
;
extern _PB_SetBundleCurrentDirectory
extern _memset
;
;
extern PB_MemoryBase
extern _PB_ArgC
extern _PB_ArgV

%macro pb_public 1
         extern _%1
  extern %1
%endmacro


extern _SYS_InitPureBasic


section .text


; ProcedureDLL __McOSXx64_demo_EXIT__()
global PB___McOSXx64_demo_EXIT__
PB___McOSXx64_demo_EXIT__:
global _PB___McOSXx64_demo_EXIT__
_PB___McOSXx64_demo_EXIT__:
_Procedure4:
___McOSXx64_demo_EXIT__:
%define PS4 48
  SUB    rsp,40
; CompilerIf Defined(demoExit,#PB_Procedure)
; EndProcedure
_EndProcedureZero5:
  XOR    rax,rax
_EndProcedure5:
  ADD    rsp,40
  RET
; ProcedureDLL.q demo_getquad()
global PB_demo_getquad
PB_demo_getquad:
global _PB_demo_getquad
_PB_demo_getquad:
_Procedure0:
_demo_getquad:
%define PS0 48
  SUB    rsp,40
; ProcedureReturn 9223372036854775807
  MOV    rax,9223372036854775807
  JMP   _EndProcedure1
; EndProcedure
_EndProcedureZero1:
  XOR    rax,rax
_EndProcedure1:
  ADD    rsp,40
  RET
; ProcedureDLL __McOSXx64_demo_INIT__()
global PB___McOSXx64_demo_INIT__
PB___McOSXx64_demo_INIT__:
global _PB___McOSXx64_demo_INIT__
_PB___McOSXx64_demo_INIT__:
_Procedure2:
___McOSXx64_demo_INIT__:
%define PS2 48
  SUB    rsp,40
; PreCompiler generated init-calls
; CompilerIf Defined(demoInit,#PB_Procedure)
; EndProcedure
_EndProcedureZero3:
  XOR    rax,rax
_EndProcedure3:
  ADD    rsp,40
  RET
section .data
pb_public PB_DEBUGGER_LineNumber
pb_public PB_DEBUGGER_IncludedFiles
pb_public PB_DEBUGGER_FileName
pb_public PB_Compiler_Unicode
pb_public PB_Compiler_Thread
pb_public PB_Compiler_Purifier
pb_public PB_Compiler_Debugger
  align  4
  align  4
  align  4
s_s:
  dq     0
  dq     -1
  align  4
  align  4
PStub_memset:
  dq    _memset

section .bss
_PB_BSSSection:
  alignb 4

I_BSSStart:
PB_InitialStackValue:  resq 1
  alignb 4
PB_DataPointer resq 1
  alignb 4
  alignb 4
  alignb 4
  alignb 4
I_BSSEnd:
section .data
SYS_EndDataSection:



desc-file
Code:
; Langage used to code the library: ASM or C
ASM
; Number of windows DLL than the library need
0
; Library type (Can be OBJ or LIB)
OBJ
; Number of PureBasic library needed by the library.
1
Internal
; Help directory name.
demo
; Library functions:
__McOSXx64_demo_INIT__
InitFunction
__McOSXx64_demo_EXIT__
EndFunction
demo_getquad, () -
Quad





Example-Use-File
Code:
Debug demo_getquad()


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye