I am not getting my Head around a problem that came up all ready last week.
I have a structure which i can pass along by value without problem to any function i want to anywhere in the project (multiple .c Files). interestingly enough when i try to pass the structure by ref via a pointer i can do that just to functions outside the calling functions .c file. how that problem actually came up is because i wrote some code in a .c file i use for developing. once i am finished with a part i move it to the actual file which shall be used in the end. therefore i move the definitions of the function to the header file where it should reside to be found and the function body to the .c file. interestingly enough at that moment the call signature throws an error. if i leave the function in another .c file (with its own header file which is included in both .c files) it works without problems. anyone can shine some light on that problem?
Two .c files: Screens.c and Developer_File.c
Two .h files: Screens.h and Developer_File.h
Code: Select all
//the structure could be something like that:
struct Test{
unsigned int sibox1;
unsigned int sibox2;
};
// Screens.c has Developer_File.h included where I had during the development this definition
void manipulate_object_2(struct Test *obj);
//and in the Developer_File.c the function (this is now purely a dummy function)
void manipulate_object_2(struct Test *obj){
obj->sibox1= 425;
obj->sibox2= 470;
}
//from Screens.c i can call after
Struct Test hobj;
//without any problems:
manipulate_object_2(& hobj);
//and there is no problem. but if i move the function to the Screens.c file and the definition to the Screens.h File, commenting out in the Developer_File.c and Developer_File.h the function declarations and body i get an error…
// 438 Call signature does not match the function definition signature 'manipulate_object_2' Screens.c
Code: Select all
// this works wherever the function is no problems here...
//calling:
manipulate_object_2( hobj);
//when the function is built in this way...
void manipulate_object_2(struct Test obj); // in the .h File
void manipulate_object_2(struct Test obj){// in the .c File
obj.sibox1 = 425;
obj.sibox2 = 470;
}