From: Ralf Wildenhues Date: Sun, 3 Oct 2004 13:50:10 +0000 (+0000) Subject: * libltdl/lt__alloc.h: Declare exported functions with LT_SCOPE X-Git-Tag: release-1-9d~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc5fbfd041256be5b6989ee8d23179cf25388d0d;p=thirdparty%2Flibtool.git * libltdl/lt__alloc.h: Declare exported functions with LT_SCOPE for mingw32. * libltdl/lt__dirent.h: Ditto. * libltdl/argz._h: Ditto. Be careful about not requiring additional libltdl files when used outside of libltdl. * libltdl/slist.h: Ditto. * HACKING: Add a section on libltdl implementation layering. --- diff --git a/ChangeLog b/ChangeLog index f5503babe..9624f7d8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-10-03 Ralf Wildenhues , + Gary V. Vaughan + + * libltdl/lt__alloc.h: Declare exported functions with LT_SCOPE + for mingw32. + * libltdl/lt__dirent.h: Ditto. + * libltdl/argz._h: Ditto. Be careful about not requiring + additional libltdl files when used outside of libltdl. + * libltdl/slist.h: Ditto. + * HACKING: Add a section on libltdl implementation layering. + 2004-10-03 Gary V. Vaughan * tests/quote.test: echo is called ECHO now. Make sure we extract diff --git a/HACKING b/HACKING index e6b6ca806..14402a008 100644 --- a/HACKING +++ b/HACKING @@ -100,7 +100,91 @@ and is not part of a release distribution. variable names. Don't use `return', instead echo the result of a function and call it from within backquotes. -6. Release Procedure +6. Abstraction layers in libltdl +================================ + +* The libltdl API uses a layered approach to differentiate internal and + external interfaces, among other things. To keep the abstraction + consistent, files in a given layer may only use APIs from files in the + lower layers. The exception to this is lt__glibc.h which serves a + dual purpose, as explained later. + +* At the bottom of the stack we have the system abstraction layer, + which tries to smooth over the cracks where there are differences + between host systems and compilers. config.h is generated at + configure time and is not installed; lt_system.h is an installed + file and cannot use macros from config.h: + + lt_system.h ../config.h + +* Next up is the libc abstraction layer, which provides a uniform api + to various system libc interfaces that differ between hosts supported + by libtool. Typically, the files that implement this layer begin: + + #if defined(HAVE_CONFIG_H) + # include HAVE_CONFIG_H + #endif + #include "lt_system.h" + + Or if they are installed headers that must work outside the libtool + source tree, simply: + + #include + + This layer's interface is defined by files that are usually named with + a leading `lt__': + + ,------------. ,-----------. ,------. ,-------. + |lt__dirent.h| |lt__alloc.h| |argz.h| |slist.h| + +------------+ +-----------+ +------+ +-------+ + |lt__dirent.c| |lt__alloc.c| |argz.c| |slist.c| + `------------' `-----------' `------' `-------' + + The exceptions here are argz.h and slist.h which are used + independently of libltdl in other projects. + +* There is also a sub-layer that can be used either by the headers that + implement it, in which case its function is to avoid namespace clashes + when linked with the GNU C library; Or it can be included by code that + wants to program against a glibc like interface, where it also serves + the function of pulling in all the glibc-like functionality used by + libltdl from a single: + + #include + + It consists of the single file: + + lt__glibc.h + +* The next layer are the subsystems of the exported libltdl API, which + are defined by files that are named with a leading `lt_' (no double + underscore!): + + ,----------. ,-------------. + |lt_error.h| |lt_dlloader.h| + +----------+ +-------------+ + |lt_error.c| |lt_dlloader.c| + `----------' `-------------' + + +* The top layer of the stack is the libltdl API proper, which includes + the subsystems automatically: + + ,------. + |ltdl.h| + +------+ + |ltdl.c| + `------' + +* And finally, there is an additional internal only layer (as evidenced + by the `lt__' prefix to the filename!) that defines additional + internal interfaces that are not exported to libltdl clients, but are + shared between internal files: + + lt__private.h + + +7. Release Procedure ==================== * If you are a libtool maintainer, but have not yet registered your diff --git a/libltdl/argz_.h b/libltdl/argz_.h index 5c8d977e2..0de444d15 100644 --- a/libltdl/argz_.h +++ b/libltdl/argz_.h @@ -35,23 +35,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #if defined(LTDL) # include "lt__glibc.h" +#else +# define LT_SCOPE #endif #if defined(_cplusplus) extern "C" { #endif -error_t argz_append (char **pargz, size_t *pargz_len, - const char *buf, size_t buf_len); -error_t argz_create_sep (const char *str, int delim, - char **pargz, size_t *pargz_len); -error_t argz_insert (char **pargz, size_t *pargz_len, - char *before, const char *entry); -char * argz_next (char *argz, size_t argz_len, const char *entry); -void argz_stringify (char *argz, size_t argz_len, int sep); +LT_SCOPE error_t argz_append (char **pargz, size_t *pargz_len, + const char *buf, size_t buf_len); +LT_SCOPE error_t argz_create_sep(const char *str, int delim, + char **pargz, size_t *pargz_len); +LT_SCOPE error_t argz_insert (char **pargz, size_t *pargz_len, + char *before, const char *entry); +LT_SCOPE char * argz_next (char *argz, size_t argz_len, + const char *entry); +LT_SCOPE void argz_stringify (char *argz, size_t argz_len, int sep); #if defined(_cplusplus) } #endif +#if !defined(LTDL) +# undef LT_SCOPE +#endif + #endif /*!defined(LT__ARGZ_H)*/ diff --git a/libltdl/lt__alloc.h b/libltdl/lt__alloc.h index b571e5d6e..e1a3aa677 100644 --- a/libltdl/lt__alloc.h +++ b/libltdl/lt__alloc.h @@ -45,12 +45,12 @@ LT_BEGIN_C_DECLS /* If set, this function is called when memory allocation has failed. */ extern void (*lt__alloc_die) (void); -void *lt__malloc (size_t n); -void *lt__zalloc (size_t n); -void *lt__realloc (void *mem, size_t n); -void *lt__memdup (void const *mem, size_t n); +LT_SCOPE void *lt__malloc (size_t n); +LT_SCOPE void *lt__zalloc (size_t n); +LT_SCOPE void *lt__realloc (void *mem, size_t n); +LT_SCOPE void *lt__memdup (void const *mem, size_t n); -char *lt__strdup (const char *string); +LT_SCOPE char *lt__strdup (const char *string); LT_END_C_DECLS diff --git a/libltdl/lt__dirent.h b/libltdl/lt__dirent.h index 4c2b4e219..e878b53ef 100644 --- a/libltdl/lt__dirent.h +++ b/libltdl/lt__dirent.h @@ -86,9 +86,9 @@ typedef struct } DIR; -DIR * opendir (const char *path); -struct dirent * readdir (DIR *entry); -void closedir (DIR *entry); +LT_SCOPE DIR * opendir (const char *path); +LT_SCOPE struct dirent *readdir (DIR *entry); +LT_SCOPE void closedir (DIR *entry); LT_END_C_DECLS diff --git a/libltdl/slist.h b/libltdl/slist.h index 422a2e2b5..4906145cb 100644 --- a/libltdl/slist.h +++ b/libltdl/slist.h @@ -40,10 +40,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #if !defined(SLIST_H) #define SLIST_H 1 -#include +#if defined(LTDL) +# include +#else +# define LT_SCOPE +#endif - -LT_BEGIN_C_DECLS +#if defined(_cplusplus) +extern "C" { +#endif typedef struct slist { struct slist *next; /* chain forward pointer*/ @@ -76,6 +81,12 @@ LT_SCOPE void * slist_foreach (SList *slist, SListCallback *foreach, LT_SCOPE SList *slist_box (const void *userdata); LT_SCOPE void * slist_unbox (SList *item); -LT_END_C_DECLS +#if defined(_cplusplus) +} +#endif + +#if !defined(LTDL) +# undef LT_SCOPE +#endif #endif /*!defined(SLIST_H)*/