Last active
February 7, 2017 13:19
-
-
Save bennofs/d5055a3bfbae6863c6875390f036b0ea 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
#include <stdio.h> | |
void foo(void); | |
void bar(void) { | |
foo(); | |
puts("bar\n"); | |
} |
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
#include <stdio.h> | |
void foo(void) { | |
puts("foo\n"); | |
} |
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
void bar(void); | |
int main() { | |
bar(); | |
} |
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
CFLAGS += -fPIC | |
all: main | |
main: main.o foo/libfoo.so bar/libbar.so | |
cc -Wl,--copy-dt-needed-entries -Wl,--no-as-needed main.o -o $@ -Wl,-rpath,$(PWD)/bar -Lbar -lbar | |
clean: | |
rm *.o foo bar -r | |
foo/libfoo.so: foo.o | |
mkdir -p foo | |
cc foo.o -o $@ -shared -Wl,-soname,libfoo.so | |
bar/libbar.so: bar.o foo/libfoo.so | |
mkdir -p bar | |
cc bar.o -o $@ -shared -Wl,-soname,libbar.so -Lfoo -lfoo -Wl,-rpath,$(PWD)/foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment