Last active
August 29, 2015 14:00
-
-
Save shinh/c070a213b3d56aa54e34 to your computer and use it in GitHub Desktop.
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
// gcc -fPIC -shared z.c -o libz.so | |
#include <stdio.h> | |
void func() { | |
puts("z"); | |
} | |
// gcc -fPIC -shared y.c -o liby.so -L. -lz | |
#include <stdio.h> | |
void func() { | |
puts("y"); | |
} | |
void func_in_y() { | |
func(); | |
} | |
// gcc x.c -o x -L. -ly | |
#include <stdio.h> | |
void func() { | |
puts("x"); | |
} | |
int main() { | |
func_in_y(); | |
return 0; | |
} | |
// LD_LIBRARY_PATH=. ./x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment