help-libidn
[Top][All Lists]
Advanced

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

Re: Small build changes for win32


From: Simon Josefsson
Subject: Re: Small build changes for win32
Date: Fri, 31 Aug 2007 12:30:09 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Simon Josefsson <address@hidden> writes:

>> That's really the better solution (and works fine with msvc &
>> mingw). Don't know why I removed the const - imho gcc throwed a
>> compiler error and then I gave up :)
>
> OK, good.  I'll see if I can incorporate something similar.

Please try the regenerated snapshot at:

http://daily.josefsson.org/libidn/libidn-20070831.tar.gz

I ended up with the patch below, mostly inspired by gettext:

http://cvs.savannah.gnu.org/viewvc/gettext/gettext-tools/woe32dll/export.h?revision=1.2&root=gettext&view=markup
http://cvs.savannah.gnu.org/viewvc/gettext/gettext-tools/configure.ac?revision=1.91&root=gettext&view=markup

/Simon

commit 5460a0c7ae47d75c18e17adfdffc5251bd0711ea
Author: Simon Josefsson <address@hidden>
Date:   Fri Aug 31 12:26:09 2007 +0200

    Define LIBIDN_BUILDING, for Windows hack in stringprep.h.in.
    Inspired by report and patch by "Christian Ehrlicher" <address@hidden>,
    see <http://lists.gnu.org/archive/html/help-libidn/2007-08/msg00003.html>.

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 01ff47f..9355590 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -21,7 +21,7 @@
 EXTRA_DIST = gen-stringprep-tables.pl gen-unicode-tables.pl gen-tld-tables.pl
 
 AM_CPPFLAGS = -I$(srcdir)/gl -Igl
-DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+DEFS = -DLIBIDN_BUILDING -DLOCALEDIR=\"$(localedir)\" @DEFS@
 
 lib_LTLIBRARIES = libidn.la
 

commit d1e5e072e9673ef837635db9e1e2b8a5406d0151
Author: Simon Josefsson <address@hidden>
Date:   Fri Aug 31 12:25:51 2007 +0200

    Mark variables with __declspec(import) on Windows.
    Inspired by report and patch by "Christian Ehrlicher" <address@hidden>,
    see <http://lists.gnu.org/archive/html/help-libidn/2007-08/msg00003.html>.

diff --git a/lib/stringprep.h.in b/lib/stringprep.h.in
index c5afb97..4dafb90 100644
--- a/lib/stringprep.h.in
+++ b/lib/stringprep.h.in
@@ -31,6 +31,16 @@ extern "C"
 #include <unistd.h>            /* ssize_t */
 #include <idn-int.h>           /* uint32_t */
 
+  /* On Windows, variables that may be in a DLL must be marked
+   * specially.  This is only active when not building libidn itself
+   * (!LIBIDN_BUILDING).  It is only used for MinGW which declare
+   * __DECLSPEC_SUPPORTED or MSVC (_MSC_VER && _DLL). */
+#if !defined (LIBIDN_BUILDING) && (defined(__DECLSPEC_SUPPORTED) || 
(defined(_MSC_VER) && defined(_DLL)))
+# define IDN_DLL_VAR __declspec (dllimport)
+#else
+# define IDN_DLL_VAR
+#endif
+
 #define STRINGPREP_VERSION "@PACKAGE_VERSION@"
 
 /* Error codes. */
@@ -99,30 +109,30 @@ extern "C"
   };
   typedef struct Stringprep_profiles Stringprep_profiles;
 
-  extern const Stringprep_profiles stringprep_profiles[];
+  extern IDN_DLL_VAR const Stringprep_profiles stringprep_profiles[];
 
 /* Profiles */
-  extern const Stringprep_table_element stringprep_rfc3454_A_1[];
-  extern const Stringprep_table_element stringprep_rfc3454_B_1[];
-  extern const Stringprep_table_element stringprep_rfc3454_B_2[];
-  extern const Stringprep_table_element stringprep_rfc3454_B_3[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_1_1[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_1_2[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_2_1[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_2_2[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_3[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_4[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_5[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_6[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_7[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_8[];
-  extern const Stringprep_table_element stringprep_rfc3454_C_9[];
-  extern const Stringprep_table_element stringprep_rfc3454_D_1[];
-  extern const Stringprep_table_element stringprep_rfc3454_D_2[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_A_1[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_B_1[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_B_2[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_B_3[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_1_1[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_1_2[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_2_1[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_2_2[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_3[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_4[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_5[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_6[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_7[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_8[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_C_9[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_D_1[];
+  extern IDN_DLL_VAR const Stringprep_table_element stringprep_rfc3454_D_2[];
 
   /* Nameprep */
 
-  extern const Stringprep_profile stringprep_nameprep[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_nameprep[];
 
 #define stringprep_nameprep(in, maxlen)                        \
   stringprep(in, maxlen, 0, stringprep_nameprep)
@@ -132,25 +142,25 @@ extern "C"
 
   /* SASL */
 
-  extern const Stringprep_profile stringprep_saslprep[];
-  extern const Stringprep_profile stringprep_plain[];
-  extern const Stringprep_profile stringprep_trace[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_saslprep[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_plain[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_trace[];
 
 #define stringprep_plain(in, maxlen)           \
   stringprep(in, maxlen, 0, stringprep_plain)
 
   /* Kerberos */
 
-  extern const Stringprep_profile stringprep_kerberos5[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_kerberos5[];
 
 #define stringprep_kerberos5(in, maxlen)               \
   stringprep(in, maxlen, 0, stringprep_kerberos5)
 
   /* XMPP */
 
-  extern const Stringprep_profile stringprep_xmpp_nodeprep[];
-  extern const Stringprep_profile stringprep_xmpp_resourceprep[];
-  extern const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_xmpp_nodeprep[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_xmpp_resourceprep[];
+  extern IDN_DLL_VAR const Stringprep_table_element 
stringprep_xmpp_nodeprep_prohibit[];
 
 #define stringprep_xmpp_nodeprep(in, maxlen)           \
   stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep)
@@ -159,7 +169,7 @@ extern "C"
 
   /* iSCSI */
 
-  extern const Stringprep_profile stringprep_iscsi[];
+  extern IDN_DLL_VAR const Stringprep_profile stringprep_iscsi[];
 
 #define stringprep_iscsi(in, maxlen)           \
   stringprep(in, maxlen, 0, stringprep_iscsi)




reply via email to

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