I compiling a very large system with fortran, ada, c, and C++. The different componets are being compilied and placed in archives then linked toghether. A problem I am seeing is that functions written in C and referenced externally by other C functions seem to drop data. Example Program:
void main()
{
myFunction();
}
Output is:
var1 = 0;
var2 = 0.000;
in File1.c:
void somefunction(int var1, float var2){
printf("var1 = %d\n",var1);
printf("var2 = %f\n",var2);
}
in Files2.c:
void myFunction(){
int var1 = 5;
float var2 = 5.5;
somefunction(var1, var2);
}
However if I change somecfunction to:
void somefunction(int *var1, float *var2)
and pass the variables in by reference the output is correct. Can anyone explain why this problem is happening and a fix so i don't have to change all the functions to pass by reference. Also this is not happening in all cases. Thanks.
void main()
{
myFunction();
}
Output is:
var1 = 0;
var2 = 0.000;
in File1.c:
void somefunction(int var1, float var2){
printf("var1 = %d\n",var1);
printf("var2 = %f\n",var2);
}
in Files2.c:
void myFunction(){
int var1 = 5;
float var2 = 5.5;
somefunction(var1, var2);
}
However if I change somecfunction to:
void somefunction(int *var1, float *var2)
and pass the variables in by reference the output is correct. Can anyone explain why this problem is happening and a fix so i don't have to change all the functions to pass by reference. Also this is not happening in all cases. Thanks.