sauoq has asked for the wisdom of the Perl Monks concerning the following question:

I want to take a Perl/Tk program and use PAR to create a standalone Windows executable that can then be distributed.

Okay... you got me... you know me too well. I hate working on Windows and I don't really want to do this. I just kinda have to. (If I want to get paid by this client, anyway.)

So, I installed Perl...

This is perl, v5.8.7 built for MSWin32-x86-multi-thread (with 7 registered patches, see perl -V for more detail) Copyright 1987-2005, Larry Wall Binary build 813 [148120] provided by ActiveState http://www.ActiveSta +te.com ActiveState is a division of Sophos. Built Jun 6 2005 13:36:37
I also installed ActiveState ActiveTcl 8.4.11.1.175185 whether I needed it or not. (I don't know if I do, did, or ever will... but I have it now.) All right. Good to go. Oh, but I know I need PAR. No problem. I fired up ppm, install PAR, and away I go. Well, not quite. There were plenty of problems at this point. Some issue finding parl.exe was among them, which led me to realize I had to upgrade PAR because I got some horribly out of date version (0.79)... upgrading was a royal hassle, mostly because ppm upgrade PAR incorrectly reported that 0.89 is available in the Activestate Package Repository. But, with some help from the CB, I finally got that straightened out.
C:\Perl\bin>perl -MPAR -e"print $PAR::VERSION" 0.89
Okay... so, now I'm good to go! Whee...

Well, I didn't write the script I need to do this with and it's kind of a big one and not at all trivial... so I thought I'd try doing it with an extremely simple script first. Like this one:

use Tk; use Tk::TextUndo; (tkinit)->Scrolled('TextUndo')->pack; MainLoop;
which creates a cute little Tk editor that's fairly useless but somehow more fun than notepad. Anyway, I put that in a little file called pledit.pl and...
C:\Perl\bin>pp -o ple.exe pledit.pl
And did that work like a charm, or what?

No. It didn't.<gomer>Surprise! Surprise! Surprise!</gomer> As you've almost certainly correctly surmised, if it had, I wouldn't be writing this. I got this error message:

The procedure entry point PL_memory_wrap could not be located in the dynamic link library perl58.dll.

There were, at least, some slightly more juicy messages at the command prompt...

C:\Perl\bin>.\ple.exe Can't load 'C:\DOCUME~1\SAUOQ~1.LOA\LOCALS~1\Temp\par-Sauoq\cache-1129 +323134\7 e4f5644.dll' for module Encode: load_file:The specified procedure coul +d not be found at D:/Perl58/lib/DynaLoader.pm line 229. at ../blib/lib/PAR/Heavy.pm line 107 Compilation failed in require at Tk.pm line 21. BEGIN failed--compilation aborted at Tk.pm line 21. Compilation failed in require at script/pledit.pl line 1. BEGIN failed--compilation aborted at script/pledit.pl line 1.
Not that I found them that useful though...
...sigh...

Well, I've seen errors before and I know what to do. Quickly dash up a half-assed SoPW post and wait for the monks to do my job for me. Research. I found this thread and this one on gmane. But the only thing that I managed to get from reading through those is that this problem was almost certainly related to the perl58.dll shipped with 5.8.6. Well, I've got 5.8.7 and I've never had another perl on this Windows box... so that didn't give me much to go on. There was a thread on comp.lang.perl.misc that didn't help much. Then there was this thread on aspn.activestate.com (no real help.) And finally, a Super Search for "PL_memory_wrap" turned up two threads:

I've tried PAR versions 0.89 from both randyk's uwinnipeg repository and from bribes and version 0.85 from crazyinsomniac's repository to no avail. (Given randyk's responses in various discussions on this, I really had high hopes that the PAR package from his repository would work for me.) I noticed somewhere where someone downgraded perl to 5.8.6 and got things working that way, but that's not an option in my case. I'm at a bit of a loss. Has anyone had this problem and been able to correct it? Or does anyone have a PAR package that will work for me?

† I suspect these were related to the problem discussed in PPM mis-identifying / failing to upgrade some module upgrade candidates.
‡ Wouldn't it be nice if you could copy and paste the messages that pop up in Windows? Blah...

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Windows + Tk + PAR == PL_memory_wrap error.
by randyk (Parson) on Oct 15, 2005 at 04:37 UTC

    The various references you gave suggests that this is a problem peculiar to perl-5.8.7 (ActivePerl 813) and PAR. In all other cases I'm familiar with, the "procedure entry point PL_memory_wrap could not be located" error was a result of using a ppm package built with perl-5.8.x on a system with perl-5.8.y, where x > y. This made sense in the context of binary compatibility within the perl-5.8 series, and so I compile ppm packages with perl-5.8.0, which should be compatible with any later perl-5.8.x.

    However, PAR, at least when used on perl-5.8.7, seems to require using perl-5.8.7 when building a ppm package. I've made such a package up, called PAR-587, and placed it in our uwinnipeg repository. Could you give that a go and see if it works any better? I would expect that this would work (if indeed it does) only on perl-5.8.7; for earlier perl versions, the PAR package in our repository, compiled with perl-5.8.0, should be used.

      I've made such a package up, called PAR-587, and placed it in our uwinnipeg repository. Could you give that a go and see if it works any better?

      It works like a charm. Thank you, randyk! I am very grateful. If there is ever anything I can help you out with, just let me know. In the meantime, I'm going to spend my votes today ++ing all the nodes of yours I can.

      Give this man some applause, folks!

      -sauoq
      "My two cents aren't worth a dime.";
      

      randyk: until now I always used ActivestatePerl 809 for PAR/Tk. But now I can upgrade. Thank you very much

      Best regards,
      perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

      Hi randyk, when i try to get the PAR-587 module, i am only redirected here:
      http://cpan.uwinnipeg.ca/dist/PAR-587
      But that url won't give me the module :/
      where can I find the PAR-587? I want to update to the newest Perl version, too. :)
      Thanks in advance
      Vayu
        It's easiest to install the package just from the ppm shell:
        C:\> ppm ppm> install PAR-587
        assuming you have the uwinnipeg repository in your list of repositories. The link from this page that you're referring to: http://cpan.uwinnipeg.ca/dist/PAR-587, doesn't display any information on the package, but this is not because the package isn't there, but rather for reasons internal to how the dynamic content is generated from the database - I'll look at improving that.