On 7/15/07, Julien Claassen <julien@email-addr-hidden-lab.de> wrote:
> Hi!
> Sorry to bother again. But I have the following problem I can't solve.
> I need to wrap some readline-code in my c++-class. Readline has some
> function-pointers you can set to a function you wrote yourself. So I did. The
> sinature of my function ALMOST matches that expected by readline, but it
> complains about the class part of my signature:
> my function:
> char** (Midish_rl::*)(const char*, int, int);
> Readline expects:
> char8* (*)(const char*, int, int);
> I tired writing a wrapper function, but for that I need some object, I just
> tried:
> char** wrapper(const char *text, int start, int end)
> {
> return my_ui.real_function(text,start,end);
> }
>
> The code is divided between a few files, so I couldn't just a a global
> object 'my_ui', which was known at all times.
> Does anyone have an idea how to solve it?
> Note: I don't want to use any external class-libraries, which might perform
> the task, because of dependencies. Anyway, there are no standard lib, that do
> that, not that I'm aware of at least.
> Kindest regards
> Julien
>
> --------
> Music was my first love and it will be my last (John Miles)
>
> ======== FIND MY WEB-PROJECT AT: ========
> http://ltsb.sourceforge.net
> the Linux TextBased Studio guide
> ======= AND MY PERSONAL PAGES AT: =======
> http://www.juliencoder.de
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev@email-addr-hidden
> http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-dev
>
You need something like std::mem_fun. Have you looked at Boost
(http://www.boost.org)? I think boost::mem_fn will do what you want.
You could also cobble something together on your own. If your
Midish_rl class is a singleton (i.e. you only allocate one object of
that type in you program), you could add some static wrapper methods.
Otherwise, write your own member function adapters classes specific to
your situation.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-dev
Received on Mon Jul 16 20:15:03 2007
This archive was generated by hypermail 2.1.8 : Mon Jul 16 2007 - 20:15:04 EEST