Short: V1.1 plugin demo using LoadSeg Author: Dirk Stoecker Uploader: stoecker epost de (Dirk Stoecker) Type: dev/c Architecture: m68k-amigaos This example code shows how to make a plugin system using the LoadSeg() funtion. Other methods use the library system, which I think is a misuse of the system for shared libraries. This demo shows lots of methods used in development of the XAD library system, so if something is unclear, read the docs of XAD. Supported features: - Plugins may be internal and external. This allows compact executables with plugin support (but does not require external plugins). - Internal plugins get an unique ID and can be overwritten by external plugins. - Multiple plugins in one file. This allows to reuse common code. - Enforces version strings for the plugins to make the C:Version command work. - Versioning system to allow up- and downwards compatibility. How to compile: The file master.c is a normal C source code and can be compiled with any compiler without problems. The plugin files creation consist of three steps: a) The file exterheader.c is compiled to an object file. To get this file the linking option must be turned of and data modell must be large. b) The plugin source must be compiled without linking and in large data mode as well. NOTE: Using standard ANSI-C I/O-functions is not possible normally, as no startup-code is used (this is a plugin!). Also DOSBase or any other library base is not opened automatically. Either the master supplies these, or the libraries must be opened in the plugin from scratch (using AbsExecBase as starting point). c) Linking the two files together, where the extheader object is the first one and the plugin file the second. Makefiles are supplied for SAS-C and VBCC. Both files will work with GNU make and smake (except clean and cleanall targets, which only work with smake). NOTE: The functions in this example use the stack for argument passing. When creating public plugins it may be better to use registers. If you can submit adjustments and fixes feel free to send these. Feel free to use this source for own projects. History: 1.0 first version 1.1 fixed for GCC, Thanks Gunther Nikl and Daniel Allsopp for help Please contact me: ********************************************************************* * snail-mail: * e-mail: * * Dirk Stoecker * stoecker@epost.de * * Geschwister-Scholl-Str. 10 * dirk@dstoecker.de * * 01877 Bischofswerda * world wide web: * * GERMANY * http://www.dstoecker.de/ * * phone: * pgp key: * * GERMANY +49 (0)3594/706666 * get from WWW pages or keyservers * ********************************************************************* Following is my PGP signature for the corresponding LhA-File. Use ' pgpv PluginDemo.readme -o PluginDemo.lha ' to check it. Key fingerprint: B9 F2 3A 1A 29 02 75 16 6A C6 5B 7D 5E F6 16 CF. All my releases after April 2001 have a PGP signature with this key. Be alarmed if signature is missing or wrong. -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use MessageID: DJX2iLgWM1BpWvGDve7OMFAIUDUDm/OQ iQCVAwUAP8oBbbOTsAT/iOY9AQHAiQP+L/ijJDvcptA7mJhJMqc0T4EElaimj3aK AYCbaLUr7kGisMlGgAYkAAXNMCmFLYsFKgFWwGzpyruQXxvZDyLI+DZwnk6iUSQo nUFm16sGLmCjSKH2v9O6p+UC2G0xzcZbQ7TtcWaap90/Em3/2DB41M0X1mPwnzAX T2dzqOPrM3E= =F7Tl -----END PGP SIGNATURE-----