On Fri, 2 Mar 2001, Garrett Goebel wrote:

> Could someone please take a look at this and comment on it?  Even comments
> like RTFM would be an improvement over howling into the void...

RTFM.

Just kidding. See below for my comments.

Neil

> use Inline C => DATA => LIBS => '-luser32';
>
> sub foo { print "Perl main::foo called from C-land with qw(@_)\n" }
>
> set_callback("main::foo");
> call_callback();
>
> Enum_Child_Windows();
>
> __END__
> __C__
>
> #include <stdio.h>
> #include <windows.h>
>
> static char* callback;
> void set_callback(char* name) {
>     callback = name;
> }
>
> void call_callback() {
>     Inline_Stack_Vars;
>     I32 flags = 0;
>
>     printf("Hello from C-land\n");
>
>     Inline_Stack_Reset;
>     Inline_Stack_Push(newSVpvf("Apple"));
>     Inline_Stack_Push(newSVpvf("Orange"));
>     Inline_Stack_Push(newSVpvf("Neil"));
>     Inline_Stack_Done;
>
>     perl_call_method(callback, flags);
>     Inline_Stack_Void;
> }

Seems like this function works fine.

> BOOL FAR PASCAL Enum_Child_Proc (HWND hWnd, LPARAM Param) {
>   printf("Enum_Child_Proc(hWnd: %d, Param: %d)\n", hWnd, Param);
>
>   Inline_Stack_Vars;

Here's your problem. Inline_Stack_Vars declares a bunch of variables. You
can't declare variables after a statement, like printf. Get rid of the
printf.

>   I32 flags = 0;
>   Inline_Stack_Reset;
>   Inline_Stack_Push(newSViv(hWnd));
>   Inline_Stack_Push(newSViv(Param));
>   Inline_Stack_Done;
>   perl_call_method(callback, flags);
>
>   return 1;
> }
>
>
> int Enum_Child_Windows() {
>   return EnumChildWindows(NULL, *Enum_Child_Proc, 1);
> }
>
>

-- 
Vote for Your Favorite Perl & Python Programming
Accomplishments in the first Active Awards!

>> http://www.ActiveState.com/Awards <<

Reply via email to