Brian,
Good luck in striking out on your own. You might want to check with YAS on a
grant for next year. As I understand it, Damian won't be using it next year.
I'm much more able to donate $$$ to the cause, when I can explain to my wife
that it is a tax deduction ;)
In any case, it occurred to me that you don't have an example in the
Cookbook for using POPi, etc. to get at the return value from a perl
function you've called from C. Below is an extend Win32 example, I'm sure
you could cut the cruft if you view it as such.
The following 2 function Enum_Windows and Enum_Child_Windows are identical
to the Win32 variants except that they take a perl 'CODE' reference instead
of a C one.
static SV* ref_enum_windows_proc;
BOOL FAR PASCAL Enum_Windows_Proc (HWND hWnd, LPARAM Param) {
int rval;
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
Inline_Stack_Push(sv_2mortal(newSViv(hWnd)));
Inline_Stack_Push(sv_2mortal(newSViv(Param)));
Inline_Stack_Done;
call_sv(ref_enum_windows_proc, 0); // 0 = G_SCALAR
SPAGAIN;
rval = POPi;
PUTBACK;
FREETMPS;
LEAVE;
return rval;
}
bool Enum_Child_Windows(long phWnd, SV* code, long lParam) {
ref_enum_windows_proc = code;
return EnumChildWindows(phWnd, *Enum_Windows_Proc, lParam);
}
bool Enum_Windows(SV* code, long lParam) {
ref_enum_windows_proc = code;
return EnumWindows(*Enum_Windows_Proc, lParam);
}