A
Alex
Is there any problem with sending function pointers through in a
variable argument list? I have a function like the following:
typedef (*ptr2FuncType1)( int );
typedef (*ptr2FuncType2)( double );
void SomeClass:oSomething( unsigned int num_something, unsigned long
num_something_else, ptr2FuncType1 handler_one, ... )
The functions I am passing in are in a different cpp file, but they
are not memeber functions of any class.
Where the ... represents the function pointers which I am sending to
the function. Inside that function I initialize a member array that
contains those pointers to functions. So I use va_start( arglist,
handler_one ) to start the arg list.
Then to get to each function pointer I use
m_pFuncArray = va_arg( arglist, ptr2FunctionType2 );
etc....
When I try and call the functions later in another class function, I
get a program crash from memory error. The thing I am thinking is that
the program needs to code segment as well as the address of the
function to be able to call it. Is there anything special I need to do
with variable arguments to get functions pointers to work correctly?
Thanks!
Alex Earl
variable argument list? I have a function like the following:
typedef (*ptr2FuncType1)( int );
typedef (*ptr2FuncType2)( double );
void SomeClass:oSomething( unsigned int num_something, unsigned long
num_something_else, ptr2FuncType1 handler_one, ... )
The functions I am passing in are in a different cpp file, but they
are not memeber functions of any class.
Where the ... represents the function pointers which I am sending to
the function. Inside that function I initialize a member array that
contains those pointers to functions. So I use va_start( arglist,
handler_one ) to start the arg list.
Then to get to each function pointer I use
m_pFuncArray = va_arg( arglist, ptr2FunctionType2 );
etc....
When I try and call the functions later in another class function, I
get a program crash from memory error. The thing I am thinking is that
the program needs to code segment as well as the address of the
function to be able to call it. Is there anything special I need to do
with variable arguments to get functions pointers to work correctly?
Thanks!
Alex Earl