Neil,

Thank you!

It now works better. Well, the callback to the perl function when works
once. The first time called, it gets valid arguments. The second time
called, it looks like it is getting the stash followed by valid arguments. 


$Output =<<'EOF';
>perl enum.pl
foo(65628 1)
foo(  :: File::Spec::VERSION  @  *Digest::MD5::reset ::
File::Spec::Win32::ISA Exporter.pm  %   ::     0 96 1 printf
          prototype         -Ç    qw          ?   recursion
redefine              regexp     -Ç        reserve
d           semicolon              severe      -¬?      signal
substr              syntax       -Ç-¬-¬*   tain
t          -Ç   umask           ?  uninitialized           unopened
unpack              untie           -Ç
 utf8            ? void           y2k
66026 1)
Out of memory!
EOF


Any idea what's going wrong? Assumably something I'm failing to do. 

use Inline C => DATA => LIBS => '-luser32';

Enum_Child_Windows(sub { print "foo(@_)\n" });

__END__
__C__
#include <windows.h>

static SV* coderef;
void set_coderef(SV* cref) {
  coderef = cref;
}

BOOL FAR PASCAL Enum_Child_Proc (HWND hWnd, LPARAM Param) {
  Inline_Stack_Vars;
  I32 flags = 0;
  Inline_Stack_Reset;
  Inline_Stack_Push(newSViv(hWnd));
  Inline_Stack_Push(newSViv(Param));
  Inline_Stack_Done;
  call_sv(coderef, flags);

  return 1;
}

void Enum_Child_Windows(SV* code) {
  set_coderef(code);
  EnumChildWindows(NULL, *Enum_Child_Proc, 1);
}

Reply via email to