S
Shea Martin
I am trying to use a system call which takes a function ptr. My
compiler won't compile the code if I give the system_call a ptr to a
class member function, A::func(). To combat this, I created an
function, xfunc(A a), which wraps A::func(). For this to work properly,
I need to make xfunc() a friend of class A.
I am getting compile warnings regarding the system call being passed a
function ptr, when it is expecting an extern "C" function ptr. If
comment out code in xfunc() which requires it to be a friend of A, and
wrap xfunc() in extern "C" {xfun();}, then everything compiles nicely.
So now how do I get my cake and eat it too. As in, how do I define an
extern "C" function to be a friend of A?
I tried this:
class A
{
extern "C" { friend void xfunc(); }
};
but it does not compile. Anyone know the correct syntax, or is this
possible?
Thanks,
~S
compiler won't compile the code if I give the system_call a ptr to a
class member function, A::func(). To combat this, I created an
function, xfunc(A a), which wraps A::func(). For this to work properly,
I need to make xfunc() a friend of class A.
I am getting compile warnings regarding the system call being passed a
function ptr, when it is expecting an extern "C" function ptr. If
comment out code in xfunc() which requires it to be a friend of A, and
wrap xfunc() in extern "C" {xfun();}, then everything compiles nicely.
So now how do I get my cake and eat it too. As in, how do I define an
extern "C" function to be a friend of A?
I tried this:
class A
{
extern "C" { friend void xfunc(); }
};
but it does not compile. Anyone know the correct syntax, or is this
possible?
Thanks,
~S