I'm attempting to use a c library in a c++ implementation, and I get errors often having to do with "cantidate function not viable," and it appears to think that the function in the library will not function with the arguments presented in my code. The thing is, my code is literally an old implementation (in c) that works perfectly fine when compiled in c. Is there a way to make this compile as a part of my c++ environment?
Here are the errors I get:
testbed/des-lsr_routinglogic.cpp:20:27: error: no matching function for call to 'dessert_periodic_add'
periodic_refresh_nh = dessert_periodic_add(refresh_list, NULL, NULL, &refresh_neighbor_t);
^~~~~~~~~~~~~~~~~~~~
/usr/local/include/dessert.h:880:21: note: candidate function not viable: no known conversion from 'dessert_per_result_t ()' to 'dessert_periodiccallback_t *' (aka 'dessert_per_result_t (*)(void *, struct
timeval *, struct timeval *)') for 1st argument
dessert_periodic_t* dessert_periodic_add(dessert_periodiccallback_t* c, void* data, const struct timeval* scheduled, const struct timeval* interval);
^
from this line of code code:
periodic_refresh_nh = dessert_periodic_add(refresh_list, NULL, NULL, &refresh_neighbor_t);
using this excerpt of the library:
dessert_periodic_t* dessert_periodic_add(dessert_periodiccallback_t* c, void* data, const struct timeval* scheduled, const struct timeval* interval);
dessert_periodic_t* dessert_periodic_add_delayed(dessert_periodiccallback_t* c, void* data, int delay);
int dessert_periodic_del(dessert_periodic_t* p);
void dessert_register_ptr_name(void* ptr, const char* name);
const char* dessert_ptr2name(void* ptr);
I think the compiler output should be self evident to anyone experienced in combining c/c++ but it looks like gibberish to me D:
EDIT
Thank you, it was pointed out to me I left out some important definitions; The definition of refresh_list:
dessert_per_result_t refresh_list(void *data, struct timeval *scheduled, struct timeval *interval) {
pthread_rwlock_wrlock(&pp_rwlock);
node_neighbors_t *neighbor = dir_neighbors_head;
while (neighbor) {
if (neighbor->entry_age-- == 0) {
node_neighbors_t* el_to_delete = neighbor;
HASH_DEL(dir_neighbors_head, el_to_delete);
free(el_to_delete);
} else {
neighbor->weight = 1;
}
neighbor = neighbor->hh.next;
}
pthread_rwlock_unlock(&pp_rwlock);
return 0; }
The definition of dessert_per_result_t:
typedef enum _dessert_periodic_results { DESSERT_PER_KEEP = 0, DESSERT_PER_UNREGISTER = 1 } dessert_per_result_t;
dessert_periodiccallback_t is defined oddly; I will try to post it.