C:\_32\pscrpt\inline>yrt.bat string[21] = 'perl -x -S yrt.bat ' #### @rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl @rem '; #!/usr/bin/perl -w #line 15 #use Inline C => Config => # BUILD_NOISY => 1; # See compilation output use Inline C => <<'EOC'; SV * wrap_GetCommandLine() { return newSVpv(GetCommandLine(), 0); } EOC my $string = wrap_GetCommandLine(); print "string[".length($string)."] = '$string'\n"; # ------ padding -------------------------------------------------------------------------------------- __END__ :endofperl #### C:\_32\pscrpt\inline>try.bat string[20] = 'perl -x -S try.bat ' #### use ExtUtils::MakeMaker; my %options = %{ { 'NAME' => 'Win32::GetCommandLine', 'VERSION' => '0.01' } }; WriteMakefile(%options); # Remove the Makefile dependency. Causes problems on a few systems. sub MY::makefile { '' } #### #include "EXTERN.h" #include "perl.h" #include "XSUB.h" SV * wrap_GetCommandLine() { return newSVpv(GetCommandLine(), 0); } MODULE = Win32::GetCommandLine PACKAGE = Win32::GetCommandLine PROTOTYPES: DISABLE SV * wrap_GetCommandLine () #### use Win32::GetCommandLine; print "1..1\n"; my $string = Win32::GetCommandLine::wrap_GetCommandLine(); if($string =~ /perl/) {print "ok 1\n"} else {print "not ok 1\n"} #### package Win32::GetCommandLine; require DynaLoader; @ISA = qw(DynaLoader); $VERSION = '0.01'; bootstrap Win32::GetCommandLine $VERSION; 1;