gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

API/extern compilation fix


From: Pawel Kot
Subject: API/extern compilation fix
Date: Tue, 13 Jan 2004 00:08:44 +0100
User-agent: KMail/1.5.94

Hi,

The following patch should help with compilation problems on MSVC platforms 
and make it transparent for gcc. Please test it. Perhaps some adjustments to 
not conflict with include/compat.h will be needed but it should work anyway. 
I'd like to see the reports on different environments. I already tested it on 
my Slackware and on MSVC6.

I hope kmail won't break the patch.

Index: include/gnokii.h
===================================================================
RCS file: /cvsroot/gnokii/gnokii/include/gnokii.h,v
retrieving revision 1.64
diff -u -r1.64 gnokii.h
--- include/gnokii.h    30 Nov 2003 18:55:13 -0000      1.64
+++ include/gnokii.h    12 Jan 2004 23:03:57 -0000
@@ -49,8 +49,17 @@
 
 #include <stdarg.h>
        
-#ifndef API
-#  define API
+#ifdef GNOKIIDLL_EXPORTS
+#  define API __declspec(dllexport)
+#  define EAPI __declspec(dllexport)
+#else
+#  ifdef GNOKIIDLL_IMPORTS
+#    define API __declspec(dllimport)
+#    define EAPI __declspec(dllimport)
+#  else
+#    define API
+#    define EAPI extern
+#  endif
 #endif
 
 struct gn_statemachine;
@@ -69,7 +78,7 @@
 
 #include <gnokii/statemachine.h>
 
-extern API struct gn_cfg_header *gn_cfg_info;
+EAPI struct gn_cfg_header *gn_cfg_info;
 
 /* Files */
 API int gn_file_text_save(char *filename, char *text, int mode);
@@ -78,8 +87,8 @@
 API gn_memory_type gn_str2memory_type(const char *s);
 API char *gn_memory_type2str(gn_memory_type mt);
 API void gn_data_clear(gn_data *data);
-extern API gn_phone *gn_gsm_info;
-extern API gn_error (*gn_gsm_f)(gn_operation op, gn_data *data,
+EAPI gn_phone *gn_gsm_info;
+EAPI gn_error (*gn_gsm_f)(gn_operation op, gn_data *data,
                         struct gn_statemachine *state);
 API gn_error gn_gsm_initialise(struct gn_statemachine *sm);
 
@@ -100,7 +109,7 @@
 API void gn_number_sanitize(char *number, int maxlen);
 API void gn_phonebook_entry_sanitize(gn_phonebook_entry *entry);
 
-extern API void (*gn_elog_handler)(const char *fmt, va_list ap);
+EAPI void (*gn_elog_handler)(const char *fmt, va_list ap);
 API void gn_elog_write(const char *fmt, ...);
 
 API int gn_line_get(FILE *file, char *line, int count);

take care
pkot
-- 
mailto:address@hidden :: mailto:address@hidden
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku




reply via email to

[Prev in Thread] Current Thread [Next in Thread]