in reply to Re: Net::LibIDN in Windows, is it possible?
in thread Net::LibIDN in Windows, is it possible?

I'll see if I can patch the XS file so that the tests pass

UPDATE: The correct patch to apply is at https://rt.cpan.org/Ticket/Attachment/564402/285045/LibIDN_xs.diff . See Re: [Win32] "Free to wrong pool ..." error.

Not necessarily the right way to correct it. It may well lead to memory leaks, but at least it renders the module usable on Win32 (in that it enables all of the tests to pass without warning or error):
C:\> diff -u LibIDN.xs_orig LibIDN.xs --- LibIDN.xs_orig Fri Feb 6 11:48:52 2009 +++ LibIDN.xs Fri Feb 6 11:53:00 2009 @@ -27,13 +27,13 @@ return NULL; res = stringprep_profile(utf8, &output, profile, 0); - free(utf8); + /* free(utf8); */ if( (res != STRINGPREP_OK) || !output) return NULL; res_str = stringprep_convert(output, charset, "UTF-8"); - free(output); + /* free(output); */ return res_str; } @@ -96,7 +96,7 @@ if (utf8_str) { res = idna_to_ascii_8z(utf8_str, &tmp_str, fla +gs); - free(utf8_str); + /* free(utf8_str); */ } else { @@ -110,8 +110,8 @@ OUTPUT: RETVAL CLEANUP: - if (tmp_str) - free(tmp_str); + if (tmp_str){} + /* free(tmp_str); */ char * @@ -133,7 +133,7 @@ if (tmp_str) { res_str = stringprep_convert(tmp_str, charset, + "UTF-8"); - free(tmp_str); + /* free(tmp_str); */ } else { @@ -147,7 +147,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -167,7 +167,7 @@ if (utf8_str) { q = stringprep_utf8_to_ucs4(utf8_str, -1, &len +); - free(utf8_str); + /* free(utf8_str); */ } else { @@ -182,7 +182,7 @@ tmp_str = malloc(MAX_DNSLEN*sizeof(char)); len2 = MAX_DNSLEN-1; res = punycode_encode(len, q, NULL, &len2, tmp_str); - free(q); + /* free(q); */ if (res != PUNYCODE_SUCCESS) { @@ -201,7 +201,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -239,7 +239,7 @@ if (utf8_str) { res_str = stringprep_convert(utf8_str, charset +, "UTF-8") ; - free(utf8_str); + /* free(utf8_str); */ } else { @@ -254,7 +254,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -274,7 +274,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ char * @@ -450,7 +450,7 @@ XSRETURN_UNDEF; } res = stringprep_profile(utf8_str, &tmp_str, "Nameprep +", 0); - free(utf8_str); + /* free(utf8_str); */ if (res != STRINGPREP_OK) { XSRETURN_UNDEF; @@ -458,18 +458,18 @@ if (tld) { q = stringprep_utf8_to_ucs4(tmp_str, -1, &len) +; - free(tmp_str); + /* free(tmp_str); */ if (!q) { XSRETURN_UNDEF; } res = tld_check_4t(q, len, &errpos, tld_table) +; - free(q); + /* free(q); */ } else { res = tld_check_8z(tmp_str, &errpos, NULL); - free(tmp_str); + /* free(tmp_str); */ } if (res == TLD_SUCCESS) { @@ -507,7 +507,7 @@ OUTPUT: RETVAL CLEANUP: - free(res_str); + /* free(res_str); */ SV *
As you can see, all I've done is remove many of the free() calls. The are possibly other free() calls (not tested by the test suite) that also produce the "Free to wrong pool ..." error.

UPDATE: The correct patch to apply is at https://rt.cpan.org/Ticket/Attachment/564402/285045/LibIDN_xs.diff . See Re: [Win32] "Free to wrong pool ..." error.

Cheers,
Rob

Replies are listed 'Best First'.
Re^3: Net::LibIDN in Windows, is it possible?
by PerlRob (Sexton) on Sep 08, 2010 at 00:09 UTC
    I know this is an old post, but I need help getting Net::LibIDN installed in Windows. I successfully built libidn-1.12 as a static library using MinGW/MSYS and the instructions from syphilis, but now I get the following output when I create the make file...
    $ perl Makefile.PL Found LibIDN, with TLD checking support Checking if your kit is complete... Looks good Note (probably harmless): No library found for -lidn Note (probably harmless): No library found for -liconv Note (probably harmless): No library found for oldnames.lib Note (probably harmless): No library found for kernel32.lib Note (probably harmless): No library found for user32.lib Note (probably harmless): No library found for gdi32.lib Note (probably harmless): No library found for winspool.lib Note (probably harmless): No library found for comdlg32.lib Note (probably harmless): No library found for advapi32.lib Note (probably harmless): No library found for shell32.lib Note (probably harmless): No library found for ole32.lib Note (probably harmless): No library found for oleaut32.lib Note (probably harmless): No library found for netapi32.lib Note (probably harmless): No library found for uuid.lib Note (probably harmless): No library found for ws2_32.lib Note (probably harmless): No library found for mpr.lib Note (probably harmless): No library found for winmm.lib Note (probably harmless): No library found for version.lib Note (probably harmless): No library found for odbc32.lib Note (probably harmless): No library found for odbccp32.lib Note (probably harmless): No library found for msvcrt.lib Writing Makefile for Net::LibIDN
    ...and the following error when I run make:
    $ make make: *** No rule to make target `C:\Perl\libConfig.pm', needed by `Ma +kefile'. Stop.
    I feel like I'm so close, or that I'm missing something obvious. Any ideas?

    UPDATE: I've got Visual Studio 2005 installed, and if I try building with nmake, the build actually runs for a little until I get this error:
    fatal error C1083: Cannot open include file: 'stdint.h': No such file +or directory


    Thanks,
    Rob