Last active
February 9, 2022 17:05
-
-
Save commiebstrd/9f894e428ce9c0f7aeb8201c1da5c95d to your computer and use it in GitHub Desktop.
c include thing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "pipe.h" | |
#include "patch.h" // only added to show it doesn't duplicate includes | |
int main(int argc, char** argv) { | |
printf("main\r\n"); | |
imported_function(); // from patch.h->patch.c->imported_function | |
other_source_function(); // second callt to imported_function but passed through pipe.c | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build: | |
gcc -o bin main.c pipe.c patch.c | |
clean: | |
rm -f bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
// we don't need the func declaration when defining it as well (but it doesnt actually hurt either) | |
//#include "patch.h" | |
void imported_function(void) { | |
printf("Called imported_function\r\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PATCH_H | |
#define PATCH_H | |
void imported_function(void); | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "pipe.h" | |
#include "patch.h" | |
void other_source_function(void) { | |
printf("Called source code func from pipe.c\r\n"); | |
imported_function(); // from patch.h->pathc.c->imported_function | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PIPE_H | |
#define PIPE_H | |
void other_source_function(void); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment