in reply to Re^5: Win32::API Memory Exception with GetCommandLine() (which returns a static string)
in thread Win32::API Memory Exception with GetCommandLine() (which returns a static string)

The extra trailing space is explainable to the weird use the OP is making of pack:

#!/usr/bin/perl -w use strict; use Win32::API; Win32::API->Import("kernel32", "LPTSTR GetCommandLine()"); my $cl = GetCommandLine(); printf "%d : '%s'\n", length( $cl ), $cl; my $cl2 = pack 'Z*', GetCommandLine(); printf "%d : '%s'\n", length( $cl2 ), $cl2; __END__ C:\test>junk3 46 : '"c:\perl\bin\perl.exe" -sw "C:\test\junk3.pl" ' 47 : '"c:\perl\bin\perl.exe" -sw "C:\test\junk3.pl" '

I'm lost as to why the combination of pack, mingw built perl and a batch file would cause a segfault?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re^6: Win32::API Memory Exception with GetCommandLine() (which returns a static string)
  • Download Code

Replies are listed 'Best First'.
Re^7: Win32::API Memory Exception with GetCommandLine() (which returns a static string)
by Wyrdweaver (Beadle) on Jul 07, 2007 at 18:15 UTC
    I'm lost as to why the combination of pack, mingw built perl and a batch file would cause a segfault?

    I'm still at a loss on how to fix this as well. But you've all given me a couple of other avenues to take in order to tackle the issue.

    Thanks.