Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: Generating .lib files  (Read 1059 times)

0 Members and 1 Guest are viewing this topic.

Offline Minuous

Generating .lib files
« on: March 08, 2012, 08:52:38 PM »
Hello, I am doing some coding in Draco and it is missing the pragmas for certain functions that I want to use, specifically Delay() and CreateMsgPort(). Therefore the linker (SLink) is complaining about those functions. It should just be a matter of creating a .lib file with the appropriate entries. I am wondering how this is done, as they are in a binary format. Is there a tool which will do it, or at least documentation on the file format so I can manually create them? (I would imagine this would be a common issue for programmers using non-C languages such as E, Pascal, etc. and therefore likely a solved one, but I can't find anything relating to this.)
  I only really need to get these 2 function pragmas working, but if it it is easy to automate then I will generate a complete set of OS3.9 .lib files for use by other Draco programmers. Thanks.
 

Offline Thomas

Re: Generating .lib files
« Reply #1 on: March 08, 2012, 09:12:09 PM »
The OS 3.9 NDK contains amiga.lib which has stub functions for all AmigaOS functions.

Offline Minuous

Re: Generating .lib files
« Reply #2 on: March 09, 2012, 07:49:02 AM »
OK, I have added this to the list of what is linked. Now it is complaining about _TimerBase, which is odd because the program does not use timer.device at all. :-(
  If I could find some kind of ".lib editor" I could just remove the reference from amiga.lib.
 

Offline Thomas

Re: Generating .lib files
« Reply #3 on: March 09, 2012, 08:28:23 AM »
A .lib file is an object module (.o file) or a collection of object modules.

It contains stub functions for system calls. For example like this:

Code: [Select]
xref _DOSBase
xref _LVODelay
xdef _Delay
_Delay:
move.l _DOSBase,A6
move.l 4(sp),d0
jsr _LVODelay(a6)
rts

LVODelay is another symbol in amiga.lib. You can replace it by the actual offset of Delay which I don't remember without reading documentation.

xref/xdef are assembler-specific commands. They might be different for your assembler, for example xtrn or something like that. xref defines an unresolved external reference (which needs to be exported by another object module) and xdef exports a global symbol (to resolve external references of other object modules).

Offline itix

Re: Generating .lib files
« Reply #4 on: March 09, 2012, 08:32:07 AM »
Are you using TimeDelay() by any chance?
My Amigas: A500, Mac Mini and PowerBook
 

Offline Minuous

Re: Generating .lib files
« Reply #5 on: March 15, 2012, 05:06:08 AM »
No, but it was using dos.library's Delay() function at one point.