Short: Example.library in 100% C (SAS/Storm/Maxon/...) Author: Andreas R. Kleinert, Helmut Hummel, Stefan Fuchs, Aaron Digulla Uploader: Andreas_Kleinert@t-online.de Type: dev/c example.library V37.11 (24.6.97) An Amiga shared library in 100 % C language - coming with sources. Compiler Checklist: Compiler Support ------------------------------- (see README. SAS/C 6.5x yes for more information) MaxonC 3.x yes StormC 2.x yes DICE 3.x (not tested) GCC 2.7.2.1 yes AztecC (not tested) vbcc (in work) OS Checklist: Operating Sustem Support ------------------------------- Amiga OS 37-40 yes AROS 1.x yes (AROS source tree) Original SAS/C and StormC version (C) 1996-97 by Andreas R. Kleinert, MaxonC version changes done 1996 by Helmut Hummel. GCC version changes done 1997 by Stefan Fuchs. AROS source tree done 1997 by Aaron Digulla. All rights reserved. ---------------------------------------------------------------------- This sample library intends to make Amiga shared library sources compileable with any available Amiga C compiler - without any changes to the source code. And maybe in the future also running under any Amiga compatible operating system with any CPU. The first goal seams to be easily done: nearly any noticeable compiler for the Amiga does support generation of libraries by special linker commands and pre-generated object files. But when looking into the details, one will find out, that these linker functionality just reduces the influence of the programmer on how his sources are handled, that the pre-generated object files just originally were done in Assembler, and that each compiler does define its own interface definitions and usage rules. But as a programmer, it is important to have control over the _complete_ source code and to be able to compile it _anywhere_ with only minor changes, even better without any changes. Since most Amiga system modules - noticeable Libraries, Devices and Resources - do have startup-modules and other larger parts completely written in Assembler language, the most important task for getting inter-compiler and operating system independant sources in my opinion is, to completely migrate the interfaces to C language (but different to AROS, for example, it is most important, to keep the sources running under the current 68k AmigaOS in the _first_ place). This goal basically has been reached already, still missing of course are some of the less Amiga-native compilers and of course tests with any kind of "AmigaOS for PowerPC". But since Assembler is nearly as portability-hostile as BCPL _today_ we may come quite close to the goal defined above by just moving towards C. Translate your 68k-assembler library startup-codes smartly to C by simply using this source-code as an advice how to do it. For testing: install the (re)compiled example.library to LIBS: and start the test program - it should pop up a requester, then. If you can submit adjustments for the other compilers as mentioned above: feel free to send these. --- Feel free to use this source for own projects. It is allowed to be spread and distributed anywhere, as far as my consent is concerned. Amiga International, or the current owner of the technologie, is allowed to always put this source on their newest Developer CD-ROM. Thanks and credits will always be appreciated - for example, you MAY, but NEED NOT: give me credits in your program's docs, send me keyfiles for your programs using the library, and so on. But that's simply voluntarily. _________________________________________________________ | You may reach me the following way. | | Send bug-reports, money or whatever to: | |---------------------------------------------------------| | * SuperView Development & Registration * | | * DRAFU Development & Registration * | | * Image Engineer Registration Site Europe * | | | | | | PerSuaSiVe SoftWorX | | | | Andreas R. Kleinert | | Sandstrasse 1 | | D-57072 Siegen | | Germany, Europe | | | | Any snail mail to the old address will still be routed. | | | | Phone: +49-271-22869 also FAX + AM | | +49-271-22838 | | | | Weekdays after 17.00h. | | | | When calling via phone you may leave a message, | | if I'm not available - but don't expect me | | calling back to USA, Australia, ... since | | german phone rates are HIGHLY expensive. | |_________________________________________________________| http://home.t-online.de/home/Andreas_Kleinert/ eMail: Please send binaries via ARK@COB.wwbnet.de, and keep them smaller than 16 KB. Please think twice before sending them - my postbox is not unlimited in size. - Fido Andreas Kleinert 2:2457/350.18 - Usenet Andreas_Kleinert@superview.ftn.neckar-alb.de (Fido-Gate) Andreas_Kleinert@t-online.de (T-Online) ARK@COB.wwbnet.de (Z-Netz) ARK@amigaworld.com (AmigaWorld) - If nothing else works, try one of these public Fido-Usenet gateways: In Germany: Andreas_Kleinert@p18.f350.n2457.z2.fido.sub.org From USA or elsewhere: Andreas_Kleinert@p18.f350.n2457.z2.fidonet.org Known Bugs: - some versions of DOpus and all Installer versions can't fetch the version information from the library binary due to some bugs in their code. Newer DOpus versions have this fixed and C:Version for example did that task always. History: V37.11 (24.6.97) : - added "known bugs" section - LibInit now delocates library base on error (NULL return) (-> Gunter Nikl) - added AROS version, and created an additional source tree for it, since I did not get it compiled with SAS/C 6.57 and there's perhaps additional #ifdef stuf to be done. Anyone likes to merge these ? (-> Aaron Digulla) V37.10 (6.4.97) : - added GCC version by Stefan Fuchs, snfuchs@sokrates.franken.de. Thanks ! - some small changes to docs, includes and comments - still missing: DICE, Aztec, vbcc. Who does it ? - fixed ftn email address V37.6 (27.3.97) : - finetuning V37.5 (24.1.97) : - rewrote docs - added basic support for compiler independent register naming and SAS/C keyword replacements (compiler.h). Thus sources now should be easily adaptable for GCC as well. V37.4 (8.1.97) : - added FD file - added new pragma file (and dir) as include/pragma/example_lib.h which works with Aztec, Maxon, Storm, DICE and SAS C compilers. Thanks to fd2pragma and Dirk Stoecker. - some fixes to the readme files - updated eMail list V37.3 (3.1.97) : - slightly changed SCOPTIONS - fixed some style things (APTR and library casts) - changed note about library opening at L_OpenLibs() - now compileable with StormC 2.0 as well (not tested with 1.1) - see readme file for StormC - added project file for StormC 2.0, smakefile still present - select, which one you'd like to use V37.2 (12.12.96) : - applied some more changes and fixes (-> suggested by Helmut Hummel) - added icons (-> from Helmut Hummel) V37.1 (4.12.96) : - bumped version to V37 - added MaxonC 3.x version by applying changes to the SAS/C sources and adding Maxon specific make and configuration files (-> all done by Helmut Hummel, see Readme.MAXON) - added StormC support - yet missing: DICE, Aztec, GNU. Who does it ? V1.4 (30.11.96) : - added SAS/C specific Ctrl-C disabling code - made some workarounds compiler sensitive - redone all with SAS/C V6.57 - 944 Bytes ;-) V1.3 (13.9.96) : - when starting lib as executable, -1 must be returned - now caching SysBase - added some comments, where changes should not be applied - added note about sharing library bases - documented and modified sample function, so that correct a0/a1/d0/d1 and a6 usage becomes more obviously and verbose - still 940 bytes ;-) V1.2 (5.9.96) : - fixed some things resulting out of a discussion in Z-Netz V1.1 (1.9.96) : - small changes in style (only bumped versions of changed modules): o moved "examplebase.h" to include/example/ (so also adjusted LibInit.c, StartUp.c and SCOPTIONS for reflecting that) o SampleFuncs.h did contain wrong prototype (did not matter, since only used for ULONG function table within StartUp.c) o explicitely __aligned ROMTag structure V1.0 (14.8.96) : - first release --- All mentioned trademarks are subjects to their owners. ============================= Archive contents ============================= Original Packed Ratio Date Time Name -------- ------- ----- --------- -------- ------------- 1720 433 74.8% 11-Dec-96 15:39:54 +bin.info 5248 3480 33.6% 05-Dec-96 11:46:22 +TestExampleLib 450 230 48.8% 11-Dec-96 15:49:34 +TestExampleLib.info 1884 861 54.2% 01-Apr-97 11:27:18 +ReadMe.GCC 1201 683 43.1% 25-Jan-97 10:21:22 +ReadMe.MAXON 486 280 42.3% 27-Mar-97 10:33:08 +ReadMe.SAS 915 480 47.5% 25-Jan-97 10:21:12 +ReadMe.STORM 1720 433 74.8% 11-Dec-96 15:39:56 +source.info 125 117 6.4% 08-Jan-97 19:09:50 +example.fd 425 247 41.8% 05-Dec-96 11:45:24 +example_protos.h 289 185 35.9% 05-Dec-96 11:44:58 +example.h 654 319 51.2% 11-Dec-96 15:00:22 +examplebase.h 477 247 48.2% 08-Jan-97 19:10:26 +example_lib.h 311 207 33.4% 05-Dec-96 11:45:38 +example_pragmas.h 330 207 37.2% 05-Dec-96 11:45:50 +example.h 1720 433 74.8% 11-Dec-96 15:39:42 +lib_source.info 3811 1234 67.6% 01-Apr-97 11:33:26 +compiler.h 25 25 0.0% 05-Dec-96 12:07:46 +make_storm.bat 487 240 50.7% 01-Apr-97 11:27:18 +makefile.gcc 419 164 60.8% 11-Dec-96 15:31:14 +makefile.MAXON 347 232 33.1% 05-Dec-96 11:36:28 +makefile.MAXON.info 381 232 39.1% 05-Dec-96 11:36:28 +mcpp.SESSION 1596 827 48.1% 01-Apr-97 11:36:46 +SampleFuncs.c 375 249 33.6% 01-Apr-97 11:27:18 +SampleFuncs.h 216 194 10.1% 01-Apr-97 11:38:24 +SampleFuncs.o 128 105 17.9% 03-Jan-97 15:29:36 +SCOPTIONS 395 148 62.5% 05-Dec-96 11:36:28 +smakefile 95 85 10.5% 05-Dec-96 11:36:28 +smakefile.wth 1757 595 66.1% 03-Jan-97 15:44:56 +storm_project.¶ 624 350 43.9% 03-Jan-97 15:44:56 +storm_project.¶.info 622 269 56.7% 03-Jan-97 15:44:30 +storm_smakefile 119 100 15.9% 05-Dec-96 11:36:28 +SCOPTIONS 256 105 58.9% 05-Dec-96 11:36:28 +smakefile 5248 3480 33.6% 05-Dec-96 11:46:22 +TestExampleLib 673 374 44.4% 05-Dec-96 11:46:12 +TestExampleLib.c 835 394 52.8% 05-Dec-96 11:36:28 +TestExampleLib.info 300 242 19.3% 05-Dec-96 11:46:20 +TestExampleLib.o 125 117 6.4% 08-Jan-97 19:09:50 +example.fd 425 247 41.8% 05-Dec-96 11:45:24 +example_protos.h 483 246 49.0% 11-Apr-97 13:44:16 +example.h 277 177 36.1% 11-Apr-97 13:42:02 +example.h 620 315 49.1% 11-Apr-97 13:41:44 +examplebase.h 477 247 48.2% 08-Jan-97 19:10:26 +example_lib.h 311 207 33.4% 05-Dec-96 11:45:38 +example_pragmas.h 564 293 48.0% 11-Apr-97 13:43:52 +example.h 1720 433 74.8% 11-Dec-96 15:39:42 +lib_source.info 4522 1489 67.0% 11-Apr-97 14:56:44 +compiler.h 3649 1378 62.2% 11-Apr-97 14:55:38 +LibInit.c 25 25 0.0% 05-Dec-96 12:07:46 +make_storm.bat 648 297 54.1% 11-Apr-97 15:00:08 +makefile.aros 487 240 50.7% 01-Apr-97 12:27:18 +makefile.gcc 419 164 60.8% 11-Dec-96 15:31:14 +makefile.MAXON 347 232 33.1% 05-Dec-96 11:36:28 +makefile.MAXON.info 381 232 39.1% 05-Dec-96 11:36:28 +mcpp.SESSION 1641 833 49.2% 11-Apr-97 14:58:20 +SampleFuncs.c 497 307 38.2% 11-Apr-97 14:57:34 +SampleFuncs.h 128 105 17.9% 03-Jan-97 15:29:36 +SCOPTIONS 395 148 62.5% 05-Dec-96 11:36:28 +smakefile 95 85 10.5% 05-Dec-96 11:36:28 +smakefile.wth 5344 1649 69.1% 11-Apr-97 14:52:32 +StartUp.c 1757 595 66.1% 03-Jan-97 15:44:56 +storm_project.¶ 624 350 43.9% 03-Jan-97 15:44:56 +storm_project.¶.info 622 269 56.7% 03-Jan-97 15:44:30 +storm_smakefile 500 259 48.2% 11-Apr-97 15:00:48 +makefile.aros 119 100 15.9% 05-Dec-96 11:36:28 +SCOPTIONS 256 105 58.9% 05-Dec-96 11:36:28 +smakefile 664 382 42.4% 11-Apr-97 13:41:24 +TestExampleLib.c 835 394 52.8% 05-Dec-96 11:36:28 +TestExampleLib.info 872 593 31.9% 24-Jun-97 10:58:50 +example.library 1838 955 48.0% 24-Jun-97 10:43:22 +ReadMe.AROS 10940 3939 63.9% 24-Jun-97 11:01:46 +ReadMe_First 872 593 31.9% 24-Jun-97 10:58:48 +example.library 3356 1280 61.8% 24-Jun-97 10:57:40 +LibInit.c 888 543 38.8% 24-Jun-97 10:58:48 +LibInit.o 4663 1489 68.0% 24-Jun-97 10:58:12 +StartUp.c 804 492 38.8% 24-Jun-97 10:58:46 +StartUp.o -------- ------- ----- --------- -------- 89854 40290 55.1% 25-Jun-97 00:04:42 76 files