Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!liuida!micja From: micja@IDA.LiU.SE (Michael Jansson) Newsgroups: comp.sys.amiga.programmer Subject: Re: Which C-compiler can create true libraries? Keywords: Amiga libraries. Message-ID: <1991Jan11.150659.1902@ida.liu.se> Date: 11 Jan 91 15:06:59 GMT References: <1991Jan10.130040.13771@ida.liu.se> <1991Jan11.003038.17471@csun.edu> Sender: news@ida.liu.se (News Subsystem) Organization: CIS Dept, Univ of Linkoping, Sweden Lines: 51 In article <1991Jan11.003038.17471@csun.edu> swalton@solaria.csun.edu (Stephen Walton) writes: [stuff deleted] >Manx 5.0d has, unfortunately, a couple of new bugs having to do with >library code generation. To work around them: > >1. Add a dummy argument (I used int x) to the three routines in >libsup.c (myOpen, myClose, myExpunge). > >2. Do not optimize the actual library entry points, though >lower-level routines can be optimized fine. >------------------------------- >Stephen Walton, Dept. of Physics & Astronomy, Cal State Univ. Northridge > I am srw@csun.edu no matter WHAT the stupid From: line says! It is just typical that I get this information now when I just discovered how to use 5.0d last night. Big sigh ;-(. Big thanks to you for the help anyway! Further comments on the bugs: 1. This point is valid for not only the three common functions. Any function that is compiled which is also #pragma:ed with zero registers as parameters will result in bad code! (There is a mismatch on the number of parameters that are pushed/poped on the stack). The solution is to add a dummy register to all the #pragma:s that don't have any. You don't need to actually add the dummy parameters to the function. 2. All functions can be optimized if they contains a "geta4()" as the first line in the function. (The optimizer seems to be a bit confused about the use of a4!?) I guess this bug is related to point 1. I took the res_lib example and made the following changes to make it work: * Add a geta4() call as the first line in each function. * Changed the optimizer flag -so to -safmrs (every optimizer switch except -sn) * Added -bs so that I could debug the library with sdb * Added a dummy 'd0' to all the #pragmas in libsup.c that have zero registers. It now works very well! -- ########################################################## # Michael Jansson | \_/ # Internet: mij@IDA.LIU.SE | V _|_ # UUCP: uunet!liuida!mij | | Absolut Software| # BITNET: mij@SELIUIDA | ~~~