Windows: Use correct calling convention for com_err
authorAsanka Herath <asanka@secure-endpoints.com>
Wed, 14 Jul 2010 05:20:23 +0000 (01:20 -0400)
committerAsanka Herath <asanka@secure-endpoints.com>
Fri, 20 Aug 2010 17:14:13 +0000 (13:14 -0400)
lib/com_err/NTMakefile
lib/com_err/com_err.c
lib/com_err/com_err.h

index 7e7f382226ab5c2c32cab661723960e9f1f95f1d..2dbb044091ee8fbccec17f403694c44fcec21dda 100644 (file)
@@ -31,6 +31,8 @@
 
 RELDIR = lib\com_err
 
+intcflags=-DBUILD_KRB5_LIB
+
 !include ../../windows/NTMakefile.w32
 
 INCFILES=$(INCDIR)\com_err.h $(INCDIR)\com_right.h
index a43d1e3e6cde5c01fa9e983c371615be6838c41a..fe4cc2983c50cce11d3dd2a3b8b97b0b5f285e4d 100644 (file)
@@ -43,7 +43,7 @@
 struct et_list *_et_list = NULL;
 
 
-const char *
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
 error_message (long code)
 {
     static char msg[128];
@@ -61,18 +61,18 @@ error_message (long code)
     return msg;
 }
 
-int
+KRB5_LIB_FUNCTION int KRB5_LIB_CALL
 init_error_table(const char **msgs, long base, int count)
 {
     initialize_error_table_r(&_et_list, msgs, count, base);
     return 0;
 }
 
-static void
+static void KRB5_CALLCONV
 default_proc (const char *whoami, long code, const char *fmt, va_list args)
     __attribute__((__format__(__printf__, 3, 0)));
 
-static void
+static void KRB5_CALLCONV
 default_proc (const char *whoami, long code, const char *fmt, va_list args)
 {
     if (whoami)
@@ -86,7 +86,7 @@ default_proc (const char *whoami, long code, const char *fmt, va_list args)
 
 static errf com_err_hook = default_proc;
 
-void
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 com_err_va (const char *whoami,
            long code,
            const char *fmt,
@@ -95,7 +95,7 @@ com_err_va (const char *whoami,
     (*com_err_hook) (whoami, code, fmt, args);
 }
 
-void
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 com_err (const char *whoami,
         long code,
         const char *fmt,
@@ -107,7 +107,7 @@ com_err (const char *whoami,
     va_end(ap);
 }
 
-errf
+KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
 set_com_err_hook (errf new)
 {
     errf old = com_err_hook;
@@ -120,7 +120,7 @@ set_com_err_hook (errf new)
     return old;
 }
 
-errf
+KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
 reset_com_err_hook (void)
 {
     return set_com_err_hook(NULL);
@@ -134,7 +134,7 @@ static const char char_set[] =
 
 static char buf[6];
 
-const char *
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
 error_table_name(int num)
 {
     int ch;
@@ -156,7 +156,7 @@ error_table_name(int num)
     return(buf);
 }
 
-void
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
 add_to_error_table(struct et_list *new_table)
 {
     struct et_list *et;
index a8ceb969cb1dfc477c592846c5f565ab773c6c18..1fcfe7f7aa93218bfa5d48442a680c6f95c11320 100644 (file)
 #define __attribute__(X)
 #endif
 
-typedef void (*errf) (const char *, long, const char *, va_list);
+#ifndef KRB5_LIB
+#ifndef KRB5_LIB_FUNCTION
+#if defined(_WIN32)
+#define KRB5_LIB_FUNCTION __declspec(dllimport)
+#define KRB5_LIB_CALL __stdcall
+#define KRB5_LIB_VARIABLE __declspec(dllimport)
+#else
+#define KRB5_LIB_FUNCTION
+#define KRB5_LIB_CALL
+#define KRB5_LIB_VARIABLE
+#endif
+#endif
+#endif
+
+#ifdef _WIN32
+#define KRB5_CALLCONV __stdcall
+#else
+#define KRB5_CALLCONV
+#endif
+
+typedef void (KRB5_CALLCONV *errf) (const char *, long, const char *, va_list);
 
-const char * error_message (long);
-int init_error_table (const char**, long, int);
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
+error_message (long);
 
-void com_err_va (const char *, long, const char *, va_list)
+KRB5_LIB_FUNCTION int KRB5_LIB_CALL
+init_error_table (const char**, long, int);
+
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
+com_err_va (const char *, long, const char *, va_list)
     __attribute__((format(printf, 3, 0)));
 
-void com_err (const char *, long, const char *, ...)
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
+com_err (const char *, long, const char *, ...)
     __attribute__((format(printf, 3, 4)));
 
-errf set_com_err_hook (errf);
-errf reset_com_err_hook (void);
+KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
+set_com_err_hook (errf);
+
+KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
+reset_com_err_hook (void);
 
-const char *error_table_name  (int num);
+KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
+error_table_name  (int num);
 
-void add_to_error_table (struct et_list *new_table);
+KRB5_LIB_FUNCTION void KRB5_LIB_CALL
+add_to_error_table (struct et_list *new_table);
 
 #endif /* __COM_ERR_H__ */