Hi ROOTers, I encounter a problem when using [color=red]FunctionPointer[/color].
I have 2 files.
the file “fun.c” define a [color=red]FunctionPointer[/color] and a function which uses the [color=red]FunctionPointer[/color].
the file “main.c” initial the [color=red]FunctionPointer[/color] and execute the function in “fun.c” by “.x main.c”
the code is as follow:
- in "fun.c"
void color=blue();[/color] //define a [color=red]FunctionPointer[/color]
void display() //a function using the [color=red]FunctionPointer[/color]
{
[color=blue]m();[/color]
}
2.in “main.c”
#include"fun_c.dll" //“fun.c” is compiled and included
void m1()
{
cout<<“good”<<endl;
}
void main()
{
[color=blue]m[/color]=m1; //initial the [color=red]FunctionPointer[/color]
[color=blue]m(); [/color] //execute the [color=red]FunctionPointer[/color] directly is OK
display(); //use the function in “fun.c” to execute [color=red]FunctionPointer[/color] is error
}
if “fun.c” is not compiled and use directly, there is no error.
so what should i do if i want to use [color=red]FunctionPointer[/color] in a compiled file?
Thanks