Neil,
Once again thanks!
From: Neil Watkiss [mailto:[EMAIL PROTECTED]]
>
> Whenever you call Perl from C, it's a good idea to refresh yourself
> on the basics. I still go back to the perlembed manpage whenever I
> need to call Perl functions from C.
I missed perlembed in the plethora of /perl(guts|hack|call|api|xs|xstut)/. I wish someone would write a book which mashes them all together in a coherent manner. Supposedly Simon Cozens and Tim ?Christiansen? have something in the works. One can hope that it will fit the bill.
> There's the problem. You call a Perl function without cleaning up the
> stack afterwards.
Thanks. It is working now.
> I would add these lines to your code and see if
> everything starts working:
[...]
> If it does, great. If not, replace your Inline_* macros
> one-by-one with the corresponding XS macros from the
> example. Then send Brian a patch :)
I ended up using the following mix-and-match:
BOOL FAR PASCAL Enum_Child_Proc (HWND hWnd, LPARAM Param) {
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
Inline_Stack_Push(newSViv(hWnd));
Inline_Stack_Push(newSViv(Param));
Inline_Stack_Done;
call_sv(coderef, 0);
SPAGAIN;
FREETMPS;
LEAVE;
return 1;
}
It worked, but exited with an out of memory error when Inline_Stack_Vars was used. Using Inline_Stack_Reset resulted in a failure to compile.
I looked at the Inline::C.pm code, and noticed the following:
Inline_Stack_Vars dXSARGS
Inline_Stack_Reset sp = mark
The shadows of C and XS ignorance are still hanging a little heavily accross brow for me feel comfortable suggesting a patch. Hopefully Brian and/or yourself can extract something useful from the code fragment above. -I've attached the whole script on the off-chance that someone will find it interesting.
I will try to write up some documentation with better examples of what works and send Brian a patch within the week.
Once again, thank you.
I am becoming very excited at the possibilities Inline is presenting. Doors are opening...
enum.pl