Last active
August 29, 2015 14:19
-
-
Save paulproteus/ae66d1edaf95b81b7fee 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> | |
// Doing this so there is _some_ header. | |
int fiprintf(FILE *stream, const char *format, ...); | |
// Doing this to verify that we can call "fiprintf" successfully. | |
int main(void) { | |
fiprintf(stdout, "%s", "Yo.\n"); | |
} |
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
all: libintl.so hello | |
libintl.so: | |
gcc -c -Wall -Werror -fpic nothing.c | |
gcc -fpic -shared -o libintl.so nothing.c | |
hello: | |
LD_LIBRARY_PATH=. g++ -lintl hello.cxx | |
hello2: | |
g++ -Dfiprintf=fprintf hello.cxx -o hello2 |
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 <stdarg.h> | |
#include <stdio.h> | |
int fiprintf(FILE *stream, const char *format, ...) | |
{ | |
va_list args; | |
va_start(args, format); | |
int r = vfprintf(stream, format, args); | |
va_end(args); | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment