I’ve something like:
struct list{
struct list **next, **prev;
}
Global declaration:
struct list *threads = &((struct list){&threads, &threads});
void* vp_threads; /Error here: previous declaration of 'vp_threads' was here
vp_threads = threads; //Error here: conflicting types for vp_threads
2nd way I tried:
void* vp_threads = threads; //Error: initializer element is not constant
I have to do this because … (see below!)
void some_func()
{
add_head(vp_threads, ...)
...
}
void add_head(void* x, ...)
{ ... }
(PS: And there’s not main() or initialization function, this’s core.c file kind of, implementing all the functions which are in .h)
Why this’s not working, I’m just trying to make void* to point to my structure. what’s wrong with this?
try doing
in main ( or an initialization function )
you can’t put a statement in global scope. your statement
vp_threads = threads;would have to live inside a function somewhere