Skip to content

Instantly share code, notes, and snippets.

@commiebstrd
Last active February 9, 2022 17:05
Show Gist options
  • Save commiebstrd/9f894e428ce9c0f7aeb8201c1da5c95d to your computer and use it in GitHub Desktop.
Save commiebstrd/9f894e428ce9c0f7aeb8201c1da5c95d to your computer and use it in GitHub Desktop.
c include thing
#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
}
build:
gcc -o bin main.c pipe.c patch.c
clean:
rm -f bin
#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");
}
#ifndef PATCH_H
#define PATCH_H
void imported_function(void);
#endif
#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
}
#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