Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Perl Crash attempting to run Tcl code

by bkobs39 (Acolyte)
on May 20, 2013 at 20:15 UTC ( [id://1034399]=perlquestion: print w/replies, xml ) Need Help??

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

I'm attempting to communicate with an RPC Server that is accessible via a Tcl API. I've updated to the latest perl version: This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x86-multi-thread (Binary build 1603 296746) and have the Tcl Module 1.02. I've compiled the dp42.dll file for Windows 7 using the files available here: http://sourceforge.net/projects/tcldp/files/tcldp-4.2.0/. In my Perl code, I'm now able to successfully load the dll, but when I try and call one of the functions to make the RPC Client, Perl crashes with no details.

use Tcl; our $interp = Tcl->new; $interp->Eval('source Tools/rpc.tcl'); $interp->Eval('source Tools/dp_atexit.tcl'); $interp->Eval('source Tools/dp_atclose.tcl'); $interp->Eval('load Tools/dp42.dll'); $interp->Eval('set tcl_version [info patchlevel]'); my $tcl_version= $interp->GetVar('tcl_version'); print "Version of TCL: '$tcl_version'\n"; $interp->Eval('set iw [dp_MakeRPCClient <IP> <port>]');

The version of TCL is printed as '8.5.13'. However, right after this is displayed, I get the 'Perl Command Line Interpreter has stopped working' message and no details in the Event Viewer: Faulting application name: perl.exe, version: 5.16.3.1603, time stamp: 0x5140cc97 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x00000000 Faulting process id: 0x1bc8 Faulting application start time: 0x01ce559334a550b9 Faulting application path: C:\Perl\bin\perl.exe Faulting module path: unknown Report Id: 72729299-c186-11e2-babe-e06995c96f5c I can run the same commands if I invoke the Tcl shell directly. Any ideas?

Replies are listed 'Best First'.
Re: Perl Crash attempting to run Tcl code
by Anneq (Vicar) on May 20, 2013 at 20:59 UTC

    Maybe put die statements, like below, in different parts of your code to at least see what IS working before perl fails. Then you can narrow down the problem code.

    die "I'm here in $self sub() at line ##.\n";

    Sometimes, when you run code from the command line, rather from some other way of launching it, your @INC paths and environment variables might not be the same. Put this at the very top of your script and run in both scenarios:

    use strict; use warnings; $|=1; # Buffering BEGIN { print "#### Environment Variables ####\n"; foreach (keys(%ENV)) { print "$_ = $ENV{$_}\n"; } print "#### \@INC ####\n"; foreach(@INC) { print "$_\n"; } die "#### \%ENV & \@INC: ####\n"; }

    Anne

      Thanks for the suggestion. I added the code and verified that the environmental variables are identical when I run with Perl's Tcl module and when I run the 'tclsh' and output with 'parray env'.

      Also, the point at which the script fails is here:

      $interp->Eval('set iw [dp_MakeRPCClient <ip> <port>]');

Re: Perl Crash attempting to run Tcl code (depends.exe)
by Anonymous Monk on May 21, 2013 at 02:14 UTC

      Thanks for the tip on running depends.exe, here is the error:
      Second chance exception 0xC0000005 (Access Violation) occurred at address 0x7425C9F1. Exited "PERL.EXE" (process 0x186C) with code 255 (0xFF).

      Does that mean anything or should I post the entire output of depends.exe?

        Just found this in the depends.exe output as well: LoadLibraryExW("Tools/dp42.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned 0x69100000.
        GetProcAddress(0x69100000 DP42.DLL, "Dp_Init") called from "TKKIT.DLL" at address 0x0076FB21 and returned 0x69104930.
        GetProcAddress(0x69100000 DP42.DLL, "Dp_SafeInit") called from "TKKIT.DLL" at address 0x0076FB21 and returned 0x69104A50.
        GetProcAddress(0x69100000 DP42.DLL, "Dp_Unload") called from "TKKIT.DLL" at address 0x0076FB21 and returned NULL. Error: The specified procedure could not be found (127).
        GetProcAddress(0x69100000 DP42.DLL, "_Dp_Unload") called from "TKKIT.DLL" at address 0x0076FB54 and returned NULL. Error: The specified procedure could not be found (127).
        GetProcAddress(0x69100000 DP42.DLL, "Dp_SafeUnload") called from "TKKIT.DLL" at address 0x0076FB21 and returned NULL. Error: The specified procedure could not be found (127).
        GetProcAddress(0x69100000 DP42.DLL, "_Dp_SafeUnload") called from "TKKIT.DLL" at address 0x0076FB54 and returned NULL. Error: The specified procedure could not be found (127).

        Do I need to add the package to the tkkit.dll file?

Re: Perl Crash attempting to run Tcl code
by bulk88 (Priest) on May 21, 2013 at 03:50 UTC
    I could run your code and see if it crashes for me, but your sample doesn't look runable since some things were censored in it. If you can provide a runnable version of the script I can see if it crashes and give you some more detail explanations why it crashed for me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1034399]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-28 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found