Commit eaaea51b authored by Howard Chu's avatar Howard Chu
Browse files

Fixes for NT dynamic linking.

parent 8b99e6cd
......@@ -31,17 +31,8 @@
* create a replacement and hope it works
*/
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLBER_DECL
# define LDAP_F_PRE extern __declspec(LIBLBER_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
LDAP_F(void) ber_pvt_assert LDAP_P((
const char *file, int line, const char *test ));
LIBLBER_F (void) ber_pvt_assert LDAP_P(( const char *file, int line,
const char *test ));
/* Can't use LDAP_STRING(test), that'd expand to "test" */
#if defined(__STDC__) || defined(__cplusplus)
......
......@@ -25,8 +25,8 @@
# define sys_errlist ((char **)0)
#elif DECL_SYS_ERRLIST
/* have sys_errlist but need declaration */
extern int sys_nerr;
extern char *sys_errlist[];
LIBC_F (int) sys_nerr;
LIBC_F (char) *sys_errlist[];
#endif
#ifdef HAVE_STRERROR
......@@ -36,6 +36,6 @@
((err) > -1 && (err) < sys_nerr ? sys_errlist[(err)] : "unknown")
#endif
extern char* strerror_r();
LIBC_F (char *) strerror_r();
#endif /* _AC_ERRNO_H */
......@@ -18,20 +18,11 @@
#if defined( HAVE_LIBUTIL_H )
# include <libutil.h>
#else
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLUTIL_DECL
# define LDAP_F_PRE extern __declspec(LIBLUTIL_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
/* use lutil version */
LDAP_F(void) (setproctitle) LDAP_P((const char *fmt, ...)) \
LIBLUTIL_F (void) (setproctitle) LDAP_P((const char *fmt, ...)) \
LDAP_GCCATTR((format(printf, 1, 2)));
LDAP_F(int) Argc;
LDAP_F(char) **Argv;
LIBLUTIL_F (int) Argc;
LIBLUTIL_F (char) **Argv;
#endif
#endif /* LDAP_PROCTITLE */
......
......@@ -88,7 +88,7 @@
#define sock_errno() WSAGetLastError()
#define sock_errstr(e) WSAGetErrorString(e)
extern char* WSAGetErrorString LDAP_P((int));
LIBLUTIL_F (char *) WSAGetErrorString LDAP_P((int));
#elif MACOS
# define tcp_close( s ) tcpclose( s )
......@@ -139,7 +139,7 @@ extern char* WSAGetErrorString LDAP_P((int));
#if !defined( HAVE_INET_ATON ) && !defined( inet_aton )
#define inet_aton ldap_pvt_inet_aton
struct in_addr;
LDAP_F( int ) ldap_pvt_inet_aton LDAP_P(( const char *, struct in_addr * ));
LIBLDAP_F (int) ldap_pvt_inet_aton LDAP_P(( const char *, struct in_addr * ));
#endif
#if defined(__WIN32) && defined(_ALPHA)
......
......@@ -27,11 +27,11 @@
*/
#if defined(__MINGW32__) && defined(HAVE_SNPRINTF)
int snprintf(char *, size_t, const char *, ...);
LIBC_F (int) snprintf(char *, size_t, const char *, ...);
#endif
#if defined(__MINGW32__) && defined(HAVE_VSNPRINTF)
int vsnprintf(char *, size_t, const char *, va_list);
LIBC_F (int) vsnprintf(char *, size_t, const char *, va_list);
#endif
#endif /* _AC_STDARG_H */
......@@ -42,21 +42,11 @@
# endif
#endif
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLDAP_DECL
# define LDAP_F_PRE extern __declspec(LIBLDAP_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
/* use ldap_pvt_strtok instead of strtok or strtok_r! */
LDAP_F(char *) ldap_pvt_strtok LDAP_P((
char *str, const char *delim, char **pos ));
LIBLDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str, const char *delim,
char **pos ));
LDAP_F(char *) ldap_pvt_strdup LDAP_P((
const char * s ));
LIBLDAP_F(char *) ldap_pvt_strdup LDAP_P(( const char * s ));
#ifndef HAVE_STRDUP
/* strdup() is missing, declare our own version */
......@@ -64,15 +54,17 @@ LDAP_F(char *) ldap_pvt_strdup LDAP_P((
# define strdup(s) ldap_pvt_strdup(s)
#else
/* some systems fail to declare strdup */
LDAP_F(char *) (strdup)();
LIBC_F(char *) (strdup)();
#endif
/*
* some systems fail to declare strcasecmp() and strncasecmp()
* we need them declared so we can obtain pointers to them
*/
LDAP_F(int) (strcasecmp)();
LDAP_F(int) (strncasecmp)();
/* In Mingw32, strcasecmp is not in the C library, so we don't LIBC_F it */
int (strcasecmp)();
int (strncasecmp)();
#ifndef SAFEMEMCPY
# if defined( HAVE_MEMMOVE )
......
......@@ -27,19 +27,10 @@
/* note: callers of crypt(3) should include <ac/crypt.h> */
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLUTIL_DECL
# define LDAP_F_PRE extern __declspec(LIBLUTIL_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
#ifndef HAVE_GETPASS
LDAP_F(char*)(getpass) LDAP_P((const char *getpass));
LIBLUTIL_F(char*)(getpass) LDAP_P((const char *getpass));
#else
LDAP_F(char*)(getpass)();
LIBC_F(char*)(getpass)();
#endif
/* getopt() defines may be in separate include file */
......@@ -52,21 +43,13 @@ LDAP_F(char*)(getpass)();
#else
/* assume we need to declare these externs */
extern char *optarg;
extern int optind, opterr, optopt;
LIBC_F (char *) optarg;
LIBC_F (int) optind, opterr, optopt;
#endif
#ifndef HAVE_TEMPNAM
LDAP_F(char *)(tempnam) LDAP_P((
const char *tmpdir,
const char *prefix));
#endif
/* This is never even checked for or implemented if not present */
#if 0
#ifndef HAVE_MKTEMP
LDAP_F(char *)(mktemp) LDAP_P((char *));
#endif
LIBLUTIL_F(char *)(tempnam) LDAP_P(( const char *tmpdir,
const char *prefix));
#endif
/* use lutil file locking */
......
......@@ -61,48 +61,39 @@ typedef int (*AVL_CMP) LDAP_P((const void*, const void*));
typedef int (*AVL_DUP) LDAP_P((void*, void*));
typedef void (*AVL_FREE) LDAP_P((void*));
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBAVL_DECL
# define LDAP_F_PRE extern __declspec(LIBAVL_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
LDAP_F( int )
LIBAVL_F( int )
avl_free LDAP_P(( Avlnode *root, AVL_FREE dfree ));
LDAP_F( int )
LIBAVL_F( int )
avl_insert LDAP_P((Avlnode **, void*, AVL_CMP, AVL_DUP));
LDAP_F( void* )
LIBAVL_F( void* )
avl_delete LDAP_P((Avlnode **, void*, AVL_CMP));
LDAP_F( void* )
LIBAVL_F( void* )
avl_find LDAP_P((Avlnode *, const void*, AVL_CMP));
LDAP_F( void* )
LIBAVL_F( void* )
avl_find_lin LDAP_P((Avlnode *, const void*, AVL_CMP));
#ifdef AVL_NONREENTRANT
LDAP_F( void* )
LIBAVL_F( void* )
avl_getfirst LDAP_P((Avlnode *));
LDAP_F( void* )
LIBAVL_F( void* )
avl_getnext LDAP_P((void));
#endif
LDAP_F( int )
LIBAVL_F( int )
avl_dup_error LDAP_P((void*, void*));
LDAP_F( int )
LIBAVL_F( int )
avl_dup_ok LDAP_P((void*, void*));
LDAP_F( int )
LIBAVL_F( int )
avl_apply LDAP_P((Avlnode *, AVL_APPLY, void*, int, int));
LDAP_F( int )
LIBAVL_F( int )
avl_prefixapply LDAP_P((Avlnode *, void*, AVL_CMP, void*, AVL_CMP, void*, int));
/* apply traversal types */
......
......@@ -225,97 +225,88 @@ struct ldap_disptmpl {
typedef int (*ldap_writeptype) LDAP_P((
void *writeparm, char *p, ber_len_t len ));
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLDAP_DECL
# define LDAP_F_PRE extern __declspec(LIBLDAP_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
LDAP_F( int )
LIBLDAP_F( int )
ldap_init_templates LDAP_P(( char *file, struct ldap_disptmpl **tmpllistp ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_init_templates_buf LDAP_P(( char *buf,
ber_len_t buflen,
struct ldap_disptmpl **tmpllistp ));
LDAP_F( void )
LIBLDAP_F( void )
ldap_free_templates LDAP_P(( struct ldap_disptmpl *tmpllist ));
LDAP_F( struct ldap_disptmpl * )
LIBLDAP_F( struct ldap_disptmpl * )
ldap_first_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist ));
LDAP_F( struct ldap_disptmpl * )
LIBLDAP_F( struct ldap_disptmpl * )
ldap_next_disptmpl LDAP_P(( struct ldap_disptmpl *tmpllist,
struct ldap_disptmpl *tmpl ));
LDAP_F( struct ldap_disptmpl * )
LIBLDAP_F( struct ldap_disptmpl * )
ldap_name2template LDAP_P(( char *name,
struct ldap_disptmpl *tmpllist ));
LDAP_F( struct ldap_disptmpl * )
LIBLDAP_F( struct ldap_disptmpl * )
ldap_oc2template LDAP_P(( char **oclist,
struct ldap_disptmpl *tmpllist ));
LDAP_F( char ** )
LIBLDAP_F( char ** )
ldap_tmplattrs LDAP_P(( struct ldap_disptmpl *tmpl,
char **includeattrs,
int exclude,
unsigned long syntaxmask ));
LDAP_F( struct ldap_tmplitem * )
LIBLDAP_F( struct ldap_tmplitem * )
ldap_first_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl ));
LDAP_F( struct ldap_tmplitem * )
LIBLDAP_F( struct ldap_tmplitem * )
ldap_next_tmplrow LDAP_P(( struct ldap_disptmpl *tmpl,
struct ldap_tmplitem *row ));
LDAP_F( struct ldap_tmplitem * )
LIBLDAP_F( struct ldap_tmplitem * )
ldap_first_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl,
struct ldap_tmplitem *row ));
LDAP_F( struct ldap_tmplitem * )
LIBLDAP_F( struct ldap_tmplitem * )
ldap_next_tmplcol LDAP_P(( struct ldap_disptmpl *tmpl,
struct ldap_tmplitem *row,
struct ldap_tmplitem *col ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_entry2text LDAP_P(( LDAP *ld,
char *buf, LDAPMessage *entry,
struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
ldap_writeptype writeproc, void *writeparm, char *eol, int rdncount,
unsigned long opts ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_vals2text LDAP_P(( LDAP *ld,
char *buf, char **vals, char *label, int labelwidth,
unsigned long syntaxid, ldap_writeptype writeproc, void *writeparm,
char *eol, int rdncount ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_entry2text_search LDAP_P(( LDAP *ld,
char *dn, char *base, LDAPMessage *entry,
struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
ldap_writeptype writeproc, void *writeparm, char *eol, int rdncount,
unsigned long opts ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_entry2html LDAP_P(( LDAP *ld,
char *buf, LDAPMessage *entry,
struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
ldap_writeptype writeproc, void *writeparm, char *eol, int rdncount,
unsigned long opts, char *urlprefix, char *base ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_vals2html LDAP_P(( LDAP *ld,
char *buf, char **vals, char *label, int labelwidth,
unsigned long syntaxid, ldap_writeptype writeproc, void *writeparm,
char *eol, int rdncount, char *urlprefix ));
LDAP_F( int )
LIBLDAP_F( int )
ldap_entry2html_search LDAP_P(( LDAP
*ld, char *dn, char *base, LDAPMessage *entry,
struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
......
......@@ -18,23 +18,10 @@
LDAP_BEGIN_DECL
extern char *optarg;
extern int optind, opterr, optopt;
LIBLUTIL_F (char *) optarg;
LIBLUTIL_F (int) optind, opterr, optopt;
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLUTIL_DECL
# define LDAP_F_PRE extern __declspec(LIBLUTIL_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
LDAP_F( int )
getopt LDAP_P((
int,
char * const [],
const char *));
LIBLUTIL_F (int) getopt LDAP_P(( int, char * const [], const char *));
LDAP_END_DECL
......
......@@ -151,31 +151,23 @@ typedef struct berval {
} BerValue;
/* this should be moved to lber-int.h */
#ifdef __MINGW32__
# undef LDAP_F_PRE
# ifdef LIBLBER_DECL
# define LDAP_F_PRE extern __declspec(LIBLBER_DECL)
# else
# define LDAP_F_PRE extern
# endif
#endif
/*
* in bprint.c:
*/
LDAP_F( void )
LIBLBER_F( void )
ber_print_error LDAP_P((
LDAP_CONST char *data ));
LDAP_F( void )
LIBLBER_F( void )
ber_bprint LDAP_P((
LDAP_CONST char *data, ber_len_t len ));
LDAP_F( void )
LIBLBER_F( void )
ber_dump LDAP_P((
BerElement *ber, int inout ));
LDAP_F( void )
LIBLBER_F( void )
ber_sos_dump LDAP_P((
Seqorset *sos ));
......@@ -188,75 +180,75 @@ typedef int (*BERDecodeCallback) LDAP_P((
void *data,
int mode ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_tag LDAP_P((
BerElement *ber ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_skip_tag LDAP_P((
BerElement *ber,
ber_len_t *len ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_peek_tag LDAP_P((
BerElement *ber,
ber_len_t *len ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_int LDAP_P((
BerElement *ber,
ber_int_t *num ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_stringb LDAP_P((
BerElement *ber,
char *buf,
ber_len_t *len ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_stringa LDAP_P((
BerElement *ber,
char **buf ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_stringal LDAP_P((
BerElement *ber,
struct berval **bv ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_bitstringa LDAP_P((
BerElement *ber,
char **buf,
ber_len_t *len ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_null LDAP_P((
BerElement *ber ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_get_boolean LDAP_P((
BerElement *ber,
ber_int_t *boolval ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_first_element LDAP_P((
BerElement *ber,
ber_len_t *len,
char **last ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_next_element LDAP_P((
BerElement *ber,
ber_len_t *len,
LDAP_CONST char *last ));
LDAP_F( ber_tag_t )
LIBLBER_F( ber_tag_t )
ber_scanf LDAP_P((
BerElement *ber,
LDAP_CONST char *fmt,
... ));
LDAP_F( void )
LIBLBER_F( void )
ber_set_string_translators LDAP_P((
BerElement *ber,
BERTranslateProc encode_proc,
......@@ -269,74 +261,74 @@ typedef int (*BEREncodeCallback) LDAP_P((
BerElement *ber,
void *data ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_enum LDAP_P((
BerElement *ber,
ber_int_t num,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_int LDAP_P((
BerElement *ber,
ber_int_t num,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_ostring LDAP_P((
BerElement *ber,
LDAP_CONST char *str,
ber_len_t len,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_berval LDAP_P((
BerElement *ber,
LDAP_CONST struct berval *bv,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_string LDAP_P((
BerElement *ber,
LDAP_CONST char *str,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_bitstring LDAP_P((
BerElement *ber,
LDAP_CONST char *str,
ber_len_t bitlen,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_null LDAP_P((
BerElement *ber,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_boolean LDAP_P((
BerElement *ber,
ber_int_t boolval,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_start_seq LDAP_P((
BerElement *ber,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_start_set LDAP_P((
BerElement *ber,
ber_tag_t tag ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_seq LDAP_P((
BerElement *ber ));
LDAP_F( int )
LIBLBER_F( int )
ber_put_set LDAP_P((
BerElement *ber ));
LDAP_F( int )
LIBLBER_F( int )
ber_printf LDAP_P((
BerElement *ber,
LDAP_CONST char *fmt,
......@@ -347,65 +339,65 @@ ber_printf LDAP_P((
* in io.c:
*/
LDAP_F( ber_slen_t )
LIBLBER_F( ber_slen_t )
ber_read LDAP_P((
BerElement *ber,
char *buf,
ber_len_t len ));
LDAP_F( ber_slen_t )
LIBLBER_F( ber_slen_t )
ber_write LDAP_P((
BerElement *ber,
LDAP_CONST char *buf,
ber_len_t len,
int nosos ));