Hi,
I am trying to do meet these 2 requirements:
1. create a global file containing global variables that can be accessed from multiple places. Need this for multithreading. something like global.c/h to contain global data in particular the mutexes.
2. some list modules that is required from different other modules. something like list.c. there are some global list included in the global.c.
So I did this:
global.c
#include "list.c"
util.c
#include "global.c"
// need to access the global data structures defined in global.c
// also methods from list.c to perform insert/delete on global lists //defined in global.c
client_handler.c
#include "global.c"
#include "util.c"
// need to access global data structures
// need also access functions defined in list.c to perform insert/delete
// need also access utility functions defined in util.c
Now I have tried to do this. Hoping that util.c includes global.h and list.c. So including util.c in client_handler.c would solve the "redefinition" (with which the compiler is badgering for a long time) would be gone. But nothing good happens except for the shouting from the compiler.
global.c
#include "list.c"
util.c
#include "global.c"
// hoping that list.c is already included in global.c
client_handler.c
#util.c
Besides is there any elegant way to do this one place? Because managing header files seem to be a big pain in the a$$.
Thanks.