mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Replaced ISO Latin 1 code #160 with a plain blank space (ASCII code #32) where necessary git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15305 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This is a simple shared library example which consists of a set of mandatory library functions (in "lib_base.c") and a set of user-defined functions (in "lib_user.c"). Neither implement a really useful shared Amiga library: no user-callable functions are included, only what you need as the absolute minimum to make a library respond correctly to OpenLibrary() and CloseLibrary() function calls. The code is intended to serve both as a demonstration how to write an Amiga shared library and how such a library could make use of clib2 library functions that are part of the 'C' standard runtime library, but not necessarily reentrant. The term "reentrant" refers to a property of certain library functions which allows several callers to invoke them at the same time without any ill effects. Only few such functions exist, such as strcpy(), strlen() or time(). Then there are others such as localtime() or strtok() which by design are not reentrant. The thread-safe variant of the clib2 runtime library tries to provide thread-safe (and therefore reentrant) functions which could be used in an Amiga shared library. But it can only go so far. The environment for which thread-safety is defined (POSIX.1) covers application software, such as shell commands, but it does not cover the peculiarities of Amiga shared libraries. You therefore need to exercise caution when building a library which references code from the 'C' runtime library. For example, you cannot safely call assert() or exit() from within an Amiga shared library.