I'm on an Ubuntu x86_64 system.
I have this source file main.c that uses the fx function defined in the shared library libfx.so :
int fx( int a, int b);int main( void ){ int x = fx( 50, 30 ); return 0;}
Here is the definition of fx in the file fx.c used to create the shared library :
int fx( int a, int b){ return a + b;}
Questions :
1 ) Is it correct to say that we can modify the function definition internally as we like without causing incompatibilities ( I'm not referring to logical incompatibilities but just if it is correct from a technical standpoint) ? For example, could we do the following ?
int fx( int a, int b){ return a - b;}
or
int fx( int a, int b){ if ( a > 10 ){ return a + b; }else{ return a - b; }}
- Is it correct to say that incompatibilities occur if we modify any of the following :
return type
function name
numbers of paramters
type of paramaters
3 ) Do these principles also apply to single object files ? For example an object file called A that uses a function defined in B