Create demo with compile-time linking
This commit is contained in:
parent
b11e79c60b
commit
a8baacb742
5
build.sh
Executable file
5
build.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
CFLAGS="-std=c11 -pedantic -Wall -Wextra"
|
||||||
|
mkdir -p build
|
||||||
|
clang $CFLAGS -fPIC -shared mod.c -o build/libmod.so
|
||||||
|
clang $CFLAGS -Lbuild -lmod main.c -o build/demo
|
22
main.c
Normal file
22
main.c
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Camden Dixie O'Brien
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _POSIX_C_SOURCE 199309L
|
||||||
|
|
||||||
|
#include "mod.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
const struct timespec pause = { .tv_nsec = 16666667 };
|
||||||
|
while (1) {
|
||||||
|
printf("\33[2K\r%s", getmsg());
|
||||||
|
fflush(stdout);
|
||||||
|
nanosleep(&pause, NULL);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
11
mod.c
Normal file
11
mod.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Camden Dixie O'Brien
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "mod.h"
|
||||||
|
|
||||||
|
const char *getmsg(void)
|
||||||
|
{
|
||||||
|
return "hi";
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user