Hello! I was wondering if anyone on the list with knowledge of XS can help me figure out where I'm going wrong with attempting to pass a reference to a subroutine/function written in perl to an XS function I'm writing. Here's the gist:
I have a routine, say 'myFunc', that expects a pointer to another function (to be used as a callback) as a third argument. I want to be able to create this function in perl, and pass it as the third argument to 'myFunc'. I understand that there are functions such as 'call_pv', 'call_sv', etc., but I'm not actually calling it here, the other function (which I didn't write) is doing so. Anyhow, I'm thinking I've got the concepts of the data types all screwed up, and that's my problem... Perhaps I need to use a 'get_cv' somewhere? I tried that but got even more errors. Here're the errors I'm getting when trying to compile the code below (well, that isn't all of the code, but it's the part that's breaking): MyPkg.xs(52) : warning C4047: 'function' : 'unsigned long ' differs in levels of indirection from 'struct cv ** ' MyPkg.xs(52) : warning C4024: 'myFunc' : different types for formal and actual parameter 3 myFunc()'s arguments are defined as: int myFunc( HANDLEFMT lpHandle, UINT_PTR uLevelID, DWORD_PTR dwCallback, DWORD_PTR dwCallbackInstance, DWORD dwFlags ); and here's the XS code: int Process(self,level,subpass) SV* self int level CV* subpass PREINIT: HV* hself; SV** tmpsv; HANDLEFMT thisHandle; CODE: hself = (HV*) SvRV(self); RETVAL = myFunc(&thisHandle,level,&subpass,NULL,CALLBACK_FUNCTION); /* line 52 */ if(RETVAL == 0) { hv_store(hself, "ihandle", 6, newSViv((long) thisHandle), 0); } else { warn("MyPkg::Process: Unable to begin processing!\n"); } OUTPUT: RETVAL Where have I gone wrong? Please excuse my ignorance with XS and datatypes, I'm not very familiar with C and the XS documentation is like Greek to me. !c _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs