[vim] VIM unable to find iconv dll in windows (+iconv/dyn option) (#440)

66 views
Skip to first unread message

louarr

unread,
Oct 6, 2015, 8:06:51 PM10/6/15
to vim/vim

The latest iconv dll from gnuwin32 is named libiconv2.dll. Should vim also try to load this dll instead of the old libiconv.dll? For the time being I was able to solve the problem by copying libiconv2.dll to libiconv.dll.


Reply to this email directly or view it on GitHub.

Tony Mechelynck

unread,
Oct 6, 2015, 8:25:33 PM10/6/15
to vim_dev, reply+00b1d198b1faa64f7795e162fe67e3f0a3ab569...@reply.github.com
On Wed, Oct 7, 2015 at 2:06 AM, louarr <vim-dev...@256bit.org> wrote:

The latest iconv dll from gnuwin32 is named libiconv2.dll. Should vim also try to load this dll instead of the old libiconv.dll? For the time being I was able to solve the problem by copying libiconv2.dll to libiconv.dll

Vim on Windows (when compiled with +iconv/dyn) will look for either iconv.dll or libiconv.dll (see :help iconv-dynamic). IIRC libiconv.dll is considered to be the better of the two. If your libiconv2.dll is backward compatible with libiconv.dll (has the same entry points and call conventions and such) it should work.

Best regards,
Tony.

louarr

unread,
Oct 6, 2015, 9:18:27 PM10/6/15
to vim/vim, vim-dev ML

Yes it works fine. I just want to point out that users with newer windows machines will most probably download the gnuwin32 version of libiconv (libiconv2.dll) and find that vim will fail to convert their file encoding (euc-jp in my case).

mattn

unread,
Oct 7, 2015, 8:13:23 PM10/7/15
to vim/vim, vim-dev ML

dll names are hard-coded in mbyte.c. but it seems that there are more names. for example msys2 provide libiconv-2.dll not libiconv2.dll.

louarr

unread,
Oct 10, 2015, 12:58:58 AM10/10/15
to vim/vim, vim-dev ML

Closed #440.

Bram Moolenaar

unread,
Oct 11, 2015, 4:40:22 PM10/11/15
to vim/vim, vim-dev ML

Yasuhiro Matsumoto wrote:

> dll names are hard-coded in mbyte.c. but it seems that there are more
> names. for example msys2 provide libiconv-2.dll not libiconv2.dll.

Well, it's not too difficult to look for those two as well.

--
Due knot trussed yore spell chequer two fined awl miss steaks.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

mattn

unread,
Oct 11, 2015, 8:34:07 PM10/11/15
to vim/vim, vim-dev ML

@brammool But -2 will be changed if the version of libtool will be changed.

K.Takata

unread,
Oct 11, 2015, 9:52:27 PM10/11/15
to vim/vim, vim-dev ML

@mattn No, it will be changed when libiconv changes its API and if compatibility is lost. Not when libtool is changed.

mattn

unread,
Oct 12, 2015, 6:46:11 AM10/12/15
to vim_dev, v...@noreply.github.com, vim-dev...@256bit.org, reply+00b1d1980863517f9312bcdcb705515413e9043...@reply.github.com
On Monday, October 12, 2015 at 10:52:27 AM UTC+9, K.Takata wrote:
> @mattn No, it will be changed when libiconv changes its API and if compatibility is lost. Not when libtool is changed.
>
>
> —
> Reply to this email directly or view it on GitHub.

Bram, below is a patch.

diff --git a/src/mbyte.c b/src/mbyte.c
index 75559b0..7351b67 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4400,7 +4400,8 @@ static HINSTANCE hMsvcrtDLL = 0;

# ifndef DYNAMIC_ICONV_DLL
# define DYNAMIC_ICONV_DLL "iconv.dll"
-# define DYNAMIC_ICONV_DLL_ALT "libiconv.dll"
+# define DYNAMIC_ICONV_DLL_ALT1 "libiconv.dll"
+# define DYNAMIC_ICONV_DLL_ALT2 "libiconv-2.dll"
# endif
# ifndef DYNAMIC_MSVCRT_DLL
# define DYNAMIC_MSVCRT_DLL "msvcrt.dll"
@@ -4458,7 +4459,9 @@ iconv_enabled(verbose)
return TRUE;
hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL);
if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */
- hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT);
+ hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT1);
+ if (hIconvDLL == 0) /* sometimes it's called libiconv-2.dll */
+ hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT2);
if (hIconvDLL != 0)
hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL);
if (hIconvDLL == 0 || hMsvcrtDLL == 0)

mattn

unread,
Oct 12, 2015, 6:46:17 AM10/12/15
to vim/vim, vim-dev ML

Ah, I did missunderstand. @brammool so it' possible to add libiconv-2.dll.

Christian Brabandt

unread,
Oct 13, 2015, 9:07:38 AM10/13/15
to vim/vim, vim-dev ML

Bram Moolenaar

unread,
Oct 13, 2015, 9:15:51 AM10/13/15
to mattn, vim_dev, v...@noreply.github.com, vim-dev...@256bit.org, reply+00b1d1980863517f9312bcdcb705515413e9043...@reply.github.com

Yasuhiro Matsumoto wrote:

> On Monday, October 12, 2015 at 10:52:27 AM UTC+9, K.Takata wrote:
> > @mattn No, it will be changed when libiconv changes its API and if compatibility is lost. Not when libtool is changed.
> >
> >
> > —
> > Reply to this email directly or view it on GitHub.
>
> Bram, below is a patch.

Thanks. I'll also check for libiconv2.dll, which is what was mentioned
in the original report.


--
hundred-and-one symptoms of being an internet addict:
33. You name your children Eudora, Mozilla and Dotcom.
Reply all
Reply to author
Forward
0 new messages