So, I've got that problem a while back, but I took a break from programming and now I'm trying to get it working.
Now I'll try to explain what I'm trying to do:
What I'm trying to do is to send a function pointer through a class (schedule) method argument. Okay, got that working. Next I want to send the object, containing the pointer I sent before, to method of second class (scheduler), so that it can copy those pointers into a function pointers array. This gives me no errors. Next I call a method of the second class (scheduler) which executes every function pointer from the array of the second class(scheduler). And that's where the problem is. I mean it compiles fine, but the linker gives me an error like that:
Code: Select all
out/kernel.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
1. Does the problem lie within the source code?
2. Is this a linker bug?
3. Is the function pointer execution a part of standard library?
Here's the header containing both classes:
Code: Select all
#ifndef SCHEDULER
#define SCHEDULER
class schedule{
public:
void (*schedulep)();
void constructschedule(void (*schedulepa)()){
schedulep=schedulepa;
}
};
class scheduler{
int sitem;
void (*schedulesp[10])();
public:
scheduler(){
sitem=0;
}
void scheduleradd(schedule s){
if(sitem!=10){
schedulesp[sitem]=s.schedulep;
sitem++;
}
}
void schedulerexecute(){
int i=0;
while(i<sitem){
(*schedulesp[i])();
i++;
}
}
};
#endif