]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/lt__alloc.h: Declare exported functions with LT_SCOPE
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 3 Oct 2004 13:50:10 +0000 (13:50 +0000)
committerGary V. Vaughan <gary@gnu.org>
Sun, 3 Oct 2004 13:50:10 +0000 (13:50 +0000)
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.

ChangeLog
HACKING
libltdl/argz_.h
libltdl/lt__alloc.h
libltdl/lt__dirent.h
libltdl/slist.h

index f5503babe4f0ad6824d000c456d824caf526c1f9..9624f7d8bca8dff2d3a9fddb9bb68818f8b2acaf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-10-03  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>,
+           Gary V. Vaughan  <gary@gnu.org>
+
+       * 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  <gary@gnu.org>
 
        * tests/quote.test: echo is called ECHO now.  Make sure we extract
diff --git a/HACKING b/HACKING
index e6b6ca806fdd862a8597cd0c1281f3f44f17d24f..14402a0084d3801fd0c1963b39ca598a4a245e47 100644 (file)
--- 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 <libltdl/lt_system.h>
+
+  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 <libltdl/lt__glibc.h>
+
+  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
index 5c8d977e288fc1b972c101db30f83cb5b0b8afae..0de444d1581fde88d9f73404a660e3cbab647763 100644 (file)
@@ -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)*/
index b571e5d6e5ac9e1a086e38f928f0464a84b52643..e1a3aa67787cd210c23ff0e55b2e206a645eefda 100644 (file)
@@ -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
 
index 4c2b4e21914346d77b6a021f894784539842c2f1..e878b53ef71f9c4605247d91d6c53cc235289665 100644 (file)
@@ -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
 
index 422a2e2b56db9c93b09788d49357b184c66586d1..4906145cb8c106bd0c258c8b6d4b099308bb7832 100644 (file)
@@ -40,10 +40,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 #if !defined(SLIST_H)
 #define SLIST_H 1
 
-#include <libltdl/lt_system.h>
+#if defined(LTDL)
+#  include <libltdl/lt_system.h>
+#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)*/