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 10:55:05 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

"Christian Ehrlicher" <address@hidden> writes:

> Hi,
>
> To properly build (and link against) libidn on win32, I had to change 
> lib\stringprep.h.in . The problem is that exporting data on win32 is a mess :)
>
> See attached patch, it's against 1.0.

Hi!  Thanks for the patch.  I am sorry for the slow reply, for some
reason your e-mail didn't arrive at gmane.org where I read this list,
but I found it in my mailman moderator queue and in the web archives.

I'd prefer if LIBIDN_DATA_EXPORT evaluated to the empty string on
non-win32 systems, rather than to 'extern const'.  It seems in your
approach you lose the 'extern' and 'const' specifiers.  At least 'const'
seems important.  Would the following alternative approach still work on
win32?

 // we need this little hack to export/import data properly
 #ifdef _WIN32
 # ifndef BUILD_LIBIDN_LIB
 #  define LIBIDN_DATA_EXPORT __declspec(dllimport)
 # endif
 #endif
...
 extern const LIBIDN_DATA_EXPORT Stringprep_profiles stringprep_profiles[];
...

Thanks,
Simon

> Thx,
> Christian Ehrlicher
> -- 
> GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
> Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
>
> --- lib\stringprep.h.in       2007-07-31 11:26:07.000000000 +0200
> +++ lib\stringprep.h.in.orig  2007-08-22 09:50:57.375000000 +0200
> @@ -31,6 +31,17 @@
>  #include <unistd.h>          /* ssize_t */
>  #include <idn-int.h>         /* uint32_t */
>  
> +// we need this little hack to export/import data properly
> +#ifdef _WIN32
> +# ifdef BUILD_LIBIDN_LIB
> +#  define LIBIDN_DATA_EXPORT extern const
> +# else
> +#  define LIBIDN_DATA_EXPORT __declspec(dllimport)
> +# endif
> +#else
> +# define LIBIDN_DATA_EXPORT extern const
> +#endif
> +
>  #define STRINGPREP_VERSION "@PACKAGE_VERSION@"
>  
>  /* Error codes. */
> @@ -99,30 +110,30 @@
>    };
>    typedef struct Stringprep_profiles Stringprep_profiles;
>  
> -  extern const Stringprep_profiles stringprep_profiles[];
> +  LIBIDN_DATA_EXPORT 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[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_A_1[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_B_1[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_B_2[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_B_3[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_1_1[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_1_2[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_2_1[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_2_2[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_3[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_4[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_5[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_6[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_7[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_8[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_C_9[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_D_1[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element stringprep_rfc3454_D_2[];
>  
>    /* Nameprep */
>  
> -  extern const Stringprep_profile stringprep_nameprep[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_nameprep[];
>  
>  #define stringprep_nameprep(in, maxlen)                      \
>    stringprep(in, maxlen, 0, stringprep_nameprep)
> @@ -132,25 +143,25 @@
>  
>    /* SASL */
>  
> -  extern const Stringprep_profile stringprep_saslprep[];
> -  extern const Stringprep_profile stringprep_plain[];
> -  extern const Stringprep_profile stringprep_trace[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_saslprep[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_plain[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_trace[];
>  
>  #define stringprep_plain(in, maxlen)         \
>    stringprep(in, maxlen, 0, stringprep_plain)
>  
>    /* Kerberos */
>  
> -  extern const Stringprep_profile stringprep_kerberos5[];
> +  LIBIDN_DATA_EXPORT 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[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_xmpp_nodeprep[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_xmpp_resourceprep[];
> +  LIBIDN_DATA_EXPORT Stringprep_table_element 
> stringprep_xmpp_nodeprep_prohibit[];
>  
>  #define stringprep_xmpp_nodeprep(in, maxlen)         \
>    stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep)
> @@ -159,7 +170,7 @@
>  
>    /* iSCSI */
>  
> -  extern const Stringprep_profile stringprep_iscsi[];
> +  LIBIDN_DATA_EXPORT Stringprep_profile stringprep_iscsi[];
>  
>  #define stringprep_iscsi(in, maxlen)         \
>    stringprep(in, maxlen, 0, stringprep_iscsi)
> --- lib\Makefile.in   2007-08-22 09:51:31.796000000 +0200
> +++ lib\Makefile.in.orig      2007-08-22 09:57:10.093750000 +0200
> @@ -163,7 +163,7 @@
>  CXXDEPMODE = @CXXDEPMODE@
>  CXXFLAGS = @CXXFLAGS@
>  CYGPATH_W = @CYGPATH_W@
> -DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
> +DEFS = -DLOCALEDIR=\"$(localedir)\" -DBUILD_LIBIDN_LIB @DEFS@
>  DEPDIR = @DEPDIR@
>  DLLTOOL = @DLLTOOL@
>  ECHO = @ECHO@
> --- lib\Makefile.am   2007-08-22 09:42:39.843750000 +0200
> +++ lib\Makefile.am.orig      2007-08-22 10:01:39.296875000 +0200
> @@ -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 = -DLOCALEDIR=\"$(localedir)\" -DBUILD_LIBIDN_LIB @DEFS@
>  
>  lib_LTLIBRARIES = libidn.la
>  




reply via email to

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