Last active
March 23, 2022 08:28
-
-
Save k-okada/8a19f3ad507633f64d88852570042ad3 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
int func() { | |
return 100; | |
} |
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> | |
extern int func(); | |
int main() { | |
int a = func(); | |
printf("a - %d\n", a); | |
} |
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
all: main.o libfunc.so main | |
main: | |
gcc -o main main.o -Wl,-rpath=. -L. -lfunc | |
main.o: main.cpp | |
gcc -c main.cpp | |
nm main.o | |
libfunc.so: func.cpp | |
gcc -shared -o libfunc.so func.cpp | |
nm libfunc.so | |
clean: | |
-rm main main.o libfunc.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment