* 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.
This commit is contained in:
Ralf Wildenhues 2004-10-03 13:50:10 +00:00 committed by Gary V. Vaughan
parent ff1cda1ec4
commit dc5fbfd041
6 changed files with 134 additions and 21 deletions

View File

@ -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

86
HACKING
View File

@ -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

View 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)*/

View 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

View 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

View 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)*/