Created
January 27, 2020 12:41
-
-
Save ske2004/eaaa638fbc06c75d3ee7943ff1b30939 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
static void sayhi(char *text) | |
{ | |
printf("hi, %s", text); | |
} | |
struct { | |
void (*sayhi)(char*); | |
} __MODULE_ANOTHER_MODULE_C = {&sayhi}; |
This file contains hidden or 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 "modular.c" | |
#define ns __MODULE_MODULAR_C | |
#include "anothermodule.c" | |
#define am __MODULE_ANOTHER_MODULE_C | |
int main() | |
{ | |
ns.print("Hi\n"); | |
am.sayhi("me\n"); | |
return 0; | |
} |
This file contains hidden or 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> | |
static void print(char *text) | |
{ | |
printf("%s", text); | |
} | |
struct { | |
void (*print)(char*); | |
} __MODULE_MODULAR_C = {&print}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment