|
Here's what I use for the C library binary search--it takes a pointer to the function that does the actual comparison as a parameter. D* ####### c library binary search #################################### Dfindit pr * extproc('bsearch') Dlookfor * value Ddatastart * value Delements 10u 0 value Dsize 10u 0 value Dcompfunc * procptr value D* ######## nbritmrec comparison function ############################ Dcompvis pr 9b 0 Dlookfor * value Darrelt * value D *****************Some code follows********************************* C* Now the call to the binary search C C eval findelptr = findit C (%addr(dvis) : %addr(mdselthru) : C %elem(mdselthru) : %size(mdselthru) : C %paddr('COMPVIS')) This is old code. I'd probably make a couple of minor changes, but it gives you the idea of how to use a procedure pointer. I never thought about putting them in data structures, though. > -----Original Message----- > From: Jim Langston [mailto:jimlangston@conexfreight.com] > Sent: Monday, December 04, 2000 1:11 PM > To: RPG400-L@midrange.com > Subject: Re: OO in RPG > > > Please give me an example of a procedural pointer's use. Or > reference to > where I can read about them. > > Regards, > > Jim Langston > > Jon.Paris@hal.it wrote: > > > > >> Is it possible to call a function using a pointer to > the function in > > RPG? > > > > Yes - via a procedure pointer. They can be defined/stored > in a DS just as > > any other pointer can. > > > > +--- > > | This is the RPG/400 Mailing List! > > | To submit a new message, send your mail to RPG400-L@midrange.com. > > | To subscribe to this list send email to RPG400-L-SUB@midrange.com. > > | To unsubscribe from this list send email to > RPG400-L-UNSUB@midrange.com. > > | Questions should be directed to the list owner/operator: > david@midrange.com > > +--- > +--- > | This is the RPG/400 Mailing List! > | To submit a new message, send your mail to RPG400-L@midrange.com. > | To subscribe to this list send email to RPG400-L-SUB@midrange.com. > | To unsubscribe from this list send email to > RPG400-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: > david@midrange.com > +--- > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.