Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* test-module.c */
- static int privateValue = 15;
- static int getValue() {
- return privateValue;
- }
- static void setValue(int val) {
- privateValue = val;
- }
- int getPrivateValue() {
- return getValue();
- }
- void setPrivateValue(int val) {
- setValue(val);
- }
- /* main.c */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define valueOf(f, x) printf("Test: "#x" = %"#f"\n", x)
- int main(int argc, char **argv) {
- setValue(5); /* undefined reference to `setValue' */
- valueOf(d, getValue()); /* undefined reference to `getValue' */
- setPrivateValue(10);
- valueOf(d, getPrivateValue());
- exit(EXIT_SUCCESS);
- }
- /* Compilation */
- gcc -g -O2 -o testing test-module.c testing.c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement