Hi Michael, hi Jan,
Jan Dubois wrote:
> On Fri, 26 Sep 2008, Michael Carman wrote:
>> I'm having difficulties using pp to create a self-contained executable
>> of a Tkx application. Tkx depends on tkkit.dll, which isn't found when I
>> try to run the program:
>>
>> Failed to load Tcl dll! at ...DynaLoader.pm line 224.
>>
>> Tcl.pm is looking through @INC for auto/Tcl/tkkit.dll. If I open the exe
>> file using IZarc I can see that the DLL has been included under
>> /inc/lib/auto/Tcl. I checked the run cache and it isn't getting unpacked
>> (anywhere). For fun I copied tkkit.dll into /inc/lib/auto/Tcl and my
>> application ran, so this appears to be my only stumbling block.
There's code in PAR to skip unpacking shared objects to arbitrary
locations. The whole shared library aspect could do with a make-over, I
have to admit.
>> I found a thread[1] in the archives that suggested using the -l <lib>
>> option. If I do that the DLL does get unpacked to the cache root, but
>> Tcl.pm can't find it there.
In the cache root or in $cache_root . "/shlib"?
>> Is there anything I can do about this?
>
> You should be able to set the PERL_TCL_DL_PATH environment variable
> to point to the tkkit.dll. You need to do this in a BEGIN block
> before you "use" the Tcl or Tkx modules.
If you want the program to run with- or without PAR, you can check the
PAR_PROGNAME environment variable:
# untested!
use File::Spec;
use Config ();
if (exists $ENV{PAR_PROGNAME}) {
$ENV{PERL_TCL_DL_PATH} = File::Spec->catfile($ENV{PAR_TEMP}, 'shlib',
'tkkit.'.$Config::Config{dlext});
}
A final thing you could try is adding the shared object file to
inc/lib/auto/Tcl with -atkkit.dll;lib/auto/Tcl/tkkit.dll but I fear that
won't make the extraction code extract it either.
Now that I think about it, you can probably use
PAR::read_file("lib/auto/Tcl/tkkit.dll") to get the contents of the file
(hopefully in binmode) and write them to wherever you like.
PAR::par_handle() can return the Archive::Zip handle of any of the
loaded .par files including the running executable. TIMTOWTDI, I'm afraid.
Best regards,
Steffen