How to use function name as parameter?

I have a class as below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// RemoteControlMonitor.H
typedef void (*keyaction)(unsigned int key);

class RemoteControlMonitor {
private:
	keyaction rph;
	keyaction rrh;
	
public:
	RemoteControlMonitor(keyaction pressed, keyaction released = NULL) {
		rph = pressed;
		rrh = released;
		lr_set_handler(remote_control_handler);
	}
	
	void runPressed() {
		while (!shutdown_requested()) {
			remote_key = 0;
			remote_etype = 0;
			wait_event(&remote_control_pressed, 0);
			
			if (rph) {
				(*rph)(remote_key);
			}
		}
	}
};

// rcx1.C
void my_remote_pressed(unsigned int key) {
	switch(key) {
		case LRKEY_STOP:
			cputs("Stop");
			program_stop(1);
			
		default:
			break;
	}
}

RemoteControlMonitor rcm(my_remote_pressed);
int runRCM(int argc, char **argv) {
	rcm.runPressed();
	return 0;
}
int main(int argc, char **argv) {
	execi(&runRCM, 0, 0, PRIO_NORMAL + 1, DEFAULT_STACK_SIZE);
	cputs("rcm");
	return 0;
}

But I got compile error as below:
1
2
3
RemoteControlMonitor.H:58: invalid type `void *' for default argument to `void (*)(unsigned int)'
rcx1.C: In function `void __static_initialization_and_destruction_0(int, int)':
rcx1.C:54: ANSI C++ forbids implicit conversion from `void *' in default argument

What can I do? Does anyone help me?
It's not obvious what line the error message is referencing.

I don't know what lr_set_handler is.
Topic archived. No new replies allowed.