S
Szabolcs Nagy
i'm writing because i wonder about the semantics of overridden
standard functions
i imagined that when i compiled a c code then a linker would link my
code against a libc so there would be errors about multiple
definitions of overridden standard functions, however
#include <stdio.h>
int fclose(FILE *f) {
puts("overridden fclose");
return 0;
}
int main(void) {
return fclose(stdout);
}
compiles cleanly with the compiler implementations i've tried
does the standard allow this?
what should happen if i compile (and link) this code together with
other code that uses fclose()? (i guess fclose should not be
implemented by a macro in the standard lib so the overridden fclose
would be used there)
standard functions
i imagined that when i compiled a c code then a linker would link my
code against a libc so there would be errors about multiple
definitions of overridden standard functions, however
#include <stdio.h>
int fclose(FILE *f) {
puts("overridden fclose");
return 0;
}
int main(void) {
return fclose(stdout);
}
compiles cleanly with the compiler implementations i've tried
does the standard allow this?
what should happen if i compile (and link) this code together with
other code that uses fclose()? (i guess fclose should not be
implemented by a macro in the standard lib so the overridden fclose
would be used there)