Last active
December 3, 2021 06:22
-
-
Save cho0h5/e869c6b0cbe0d61cee900cb4771d364d to your computer and use it in GitHub Desktop.
C 정적 라이브러리
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 "control_light.h" | |
#include <stdio.h> | |
int turn_on(int id) { | |
printf("turn on %d\n", id); | |
return 0; | |
} | |
int turn_off(int id) { | |
printf("turn off %d\n", id); | |
return 0; | |
} | |
// gcc -c control_light.c | |
// ar rc libcontrollight.a control_light.o |
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 turn_on(int id); | |
int turn_off(int id); |
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 "control_light.h" | |
int main() { | |
turn_on(13); | |
turn_on(7); | |
turn_off(13); | |
turn_on(7); | |
return 0; | |
} | |
// gcc main.c -L./ -lcontrollight |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment