Created
September 10, 2016 01:31
-
-
Save Ravenstine/74c92bc3b6d119e548cfabab30cf7c01 to your computer and use it in GitHub Desktop.
Override Shared Library Function Calls
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
override.so:override.c | |
gcc -shared -fPIC $^ -o $@ | |
test: | |
LD_PRELOAD=$(PWD)/override.so glxgears | |
clean: | |
rm $(PWD)/override.so |
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
// This will take OpenGL calls to draw a 3D vertex | |
// and print the X coordinate. | |
// | |
// Run `make` and `make test` to see it happen. | |
#include <stdio.h> | |
void glVertex3f(float x, float y, float z){ | |
printf("%.6f", x); | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment