Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
[OT: C] Getting pointers to functionsby syphilis (Archbishop) |
on Dec 30, 2016 at 08:09 UTC ( [id://1178638]=perlquestion: print w/replies, xml ) | Need Help?? |
syphilis has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm wanting to get pointers to various mpfr library functions (because I want to provide a perl wrapping for an mpfr function that takes a "pointer to function" as one of its arguments). The following demo works fine, in so far as it goes: That gives me the numeric values of pointers to the mpfr_mul and mpfr_add functions, and I can readily construct the pointers to those functions from that info. But the problem is that there's maybe 200 mpfr functions for which I would need to create pointers - and I'm not so sure that writing separate XSubs for each of those functions is the best way to proceed. What would be good is to have a generic function that takes the name of the mpfr function as its argument, and then returns the pointer value of that mpfr function. Something like: But I don't know of any tricks that would allow that to happen. What's the best approach here ... a C lookup table ? Cheers, Rob
Back to
Seekers of Perl Wisdom
|
|