Code Comments
Programming Forum and web based access to our favorite programming groups.Hi @ all perl folk here, On a OpenVMS system with Perl 5.8.6, there are some routines in a sharable image (well, perhaps here better known as 'libxxx.so', isn't it? ;-), I have to made available from Perl which. I think this can be done by writing a wrapper using the well-known XS stuff (h2xs, xsubpp & others). However, one of these routines, when called, performs some action and then calls back a user-supplied routine, passing this routine the address of a structure which contains many data the routine can examine and - in some cases - change in addition. The structure also provides the addresses of further routines which the callback may invoke to perform additional operations. The structure exists for the live time of the callback routine only and its contents is processed further once the callback has terminated. Hm. In Perl terms, I think, the callback is a perl function and the "structure" can be expresses as a reference blessed into a package which provides the corresponding attributes and methods. I havn't however, found, any ways to implement a callback mechanism with XS. So my question: does someone know here how to accomplish this. I would very appreciate some code examples. Many thanks for any help and kind greetings from Vienna, Ferry -- Ing. Ferry Bolhar Municipality of Vienna, Department 14 A-1010 Vienna / AUSTRIA E-mail: bol@adv.magwien.gv.at
Post Follow-up to this message"Ferry Bolhar" <bol@adv.magwien.gv.at> wrote in message news:1138379440.692748@proxy.dienste.wien.at... > Hi @ all perl folk here, > > On a OpenVMS system with Perl 5.8.6, there are some routines in a sharable > image (well, perhaps here better known as 'libxxx.so', isn't it? ;-), I have > to made available from Perl which. I think this can be done by writing a > wrapper using the well-known XS stuff (h2xs, xsubpp & others). One of the "others" is Inline::C. Check it out (including the Cookbook that comes with it). For the more traditional XS approach start with 'perldoc perlxstut'. > > However, one of these routines, when called, performs some action and then > calls back a user-supplied routine, passing this routine the address of a > structure which contains many data the routine can examine and - in some > cases - change in addition. The structure also provides the addresses of > further routines which the callback may invoke to perform additional > operations. The structure exists for the live time of the callback routine > only and its contents is processed further once the callback has terminated. > > Hm. In Perl terms, I think, the callback is a perl function and the > "structure" can be expresses as a reference blessed into a package which > provides the corresponding attributes and methods. I havn't however, found, > any ways to implement a callback mechanism with XS. So my question: does > someone know here how to accomplish this. I would very appreciate some code > examples. > Can't quite follow the description .... but try 'perldoc perlcall' (which contains some excellent examples) and see if that has anything to offer you. Cheers, Rob
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.