Here are some information of how I made the Library:
I am using Suse 9.1, 2.6.4-52-default
1. Write SourceCode in PureBasic-Language (OS-Independent)
2. Use TailBite to create the .asm-Files (Under Windows)
3. Compiled the .asm Files to .o-Files with FAsm (under Linux)
4. Created an Archive containing the .o-Files with ar (ar rs DynArray.a *.o)
5. Corrected the .Desc-File (Content below)
6. Used PBLibraryMaker to create the Library and put it into PureLibraries-Directory
7. Tried to compile an ExampleSource using the Library -> LinkerError
My .asm-Files look like this (this is only one of them):
Code: Select all
format MS COFF
Public PB_DynArray_Erase
Extrn PB_PeekL
Extrn _PB_FreeMemory@4
Extrn PB_PokeL
section '.text' code readable executable
PB_DynArray_Erase:
_DynArray_Erase:
PUSH ebx
PUSH ecx
PUSH ebp
PUSH esi
PUSH edi
MOV esi,esp
SUB esp,8
MOV eax,esp
MOV edx,eax
ADD edx,8
_ClearLoop16:
MOV dword [eax],0
ADD eax,4
CMP eax,edx
JNE _ClearLoop16
MOV eax, dword [esi+24]
MOV dword [esp+0],eax
;
; DynID=PeekL(*DynArrayID)
MOV eax,dword [esp]
CALL PB_PeekL
MOV dword [esp+4],eax
;
; If DynID<>0
MOV ebx,dword [esp+4]
CMP ebx,0
JE _EndIf56
; FreeMemory(DynID-4)
MOV ebx,dword [esp+4]
ADD ebx,-4
PUSH ebx
CALL _PB_FreeMemory@4
; PokeL(*DynArrayID,0)
PUSH dword 0
MOV eax,dword [esp+4]
CALL PB_PokeL
; EndIf
_EndIf56:
;
; EndProcedure
XOR eax,eax
_EndProcedure17:
ADD esp,8
POP edi
POP esi
POP ebp
POP ecx
POP ebx
RET 4
_EndProcedure16:
My .Desc-File looks like this:
Code: Select all
ASM
;
0
;
LIB
;
4
String
StringExtension
MemoryExtension
Memory
;
DynArray.chm
;
DynArray_ReDim, Long, Long (*DynArrayID, ElementCount) - Creates or redimensionates a DynArray
Byte | StdCall
;
DynArray_Set, Long, Long, Long (*DynArrayID, ElementNumber, Value) - Sets a Value to an Element in the DynArray
Byte | StdCall
;
DynArray_Get, Long, Long (*DynArrayID, ElementNumber) - Gets a Value from an Element in the DynArray
Long | StdCall
;
DynArray_Clone, Long, Long (*DynArrayIDSrc, *DynArrayIDDest) - Clones a DynArray
Byte | StdCall
;
DynArray_Count, Long (*DynArrayID) - Returns the Count of Elements
Long | StdCall
;
DynArray_Clear, Long (*DynArrayID) - Sets all Values to 0
None | StdCall
;
DynArray_FillByPBArray, Long, Long, Long, Long (*DynArrayID, aPBarray, StartDest, ElementCount) - Fills a DynArray by a PureBasic-Array
None | StdCall
;
DynArray_GetMemoryPosition, Long (*DynArrayID) - Returns the MemoryAddress of the LongArray
Long | StdCall
;
DynArray_Erase, Long (*DynArrayID) - Destroys a DynArray
None | StdCall
;
DynArray_RemoveElement, Long, Long (*DynArrayID, ElementNumber) - Removes an Element
None | StdCall
;
DynArray_InsertElement, Long, Long, Long (*DynArrayID, ElementNumber, Value) - Insert an Element and set the Value
Byte | StdCall
;
DynArray_SetString, Long, String, Long (*DynArrayID, aString.s, StartDest) - Set a Part of the DynArray to the Bytes of a String
Byte | StdCall
;
DynArray_GetString, Long, Long, Long (*DynArrayID, StartElement, MaxLength) - Get a Part of the DynArray as a String
String | StdCall
;
These are the Messages I get when I compile an ExampleSource that uses the Library:
Code: Select all
******************************************
PureBasic Linux x86 v3.92
******************************************
Loading external modules...
Starting compilation...
108 lines processed.
Creating the executable.
DynArray.a: could not read symbols: Archive has no index; run ranlib to add one
collect2: ld returned 1 exit status
Error: Linker
When I use the original SourceCode of the Library (IncludeFile) to compile the ExampleSource, everything works fine... :monday: