aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2021-01-25 00:20:55 +0100
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2021-01-25 00:21:58 +0100
commit9eed1e8f0e14ce9725fd676d471195fb1960865f (patch)
tree188bb048f559195275ec8e6f8818116b071c60c3 /examples
parentb9327f693244663018c5dbfba2f8c124889276fe (diff)
downloadembedlog-9eed1e8f0e14ce9725fd676d471195fb1960865f.tar.gz
embedlog-9eed1e8f0e14ce9725fd676d471195fb1960865f.tar.bz2
embedlog-9eed1e8f0e14ce9725fd676d471195fb1960865f.zip
examples: add option to build examples as library
Usefull when examples are build on RTOS where binary loader is not available. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Diffstat (limited to 'examples')
-rw-r--r--examples/print-memory.c4
-rw-r--r--examples/print-options.c4
-rw-r--r--examples/print-simple.c4
-rw-r--r--examples/print-thread-safe.c4
-rw-r--r--examples/print-to-file.c4
-rw-r--r--examples/print-tty.c4
6 files changed, 24 insertions, 0 deletions
diff --git a/examples/print-memory.c b/examples/print-memory.c
index 77c6b42..8a360fe 100644
--- a/examples/print-memory.c
+++ b/examples/print-memory.c
@@ -5,7 +5,11 @@
#include "embedlog.h"
+#ifdef EMBEDLOG_DEMO_LIBRARY
+int el_demo_print_memory(void)
+#else
int main(void)
+#endif
{
char s[] = "some message\0that contains\0null characters";
char ascii[128];
diff --git a/examples/print-options.c b/examples/print-options.c
index 621e92e..1fb2bcb 100644
--- a/examples/print-options.c
+++ b/examples/print-options.c
@@ -14,7 +14,11 @@ void too_long_function_to_present_trimming_but_it_could_be_impossible()
el_print(ELN, "trimmed (I hope) function name");
}
+#ifdef EMBEDLOG_DEMO_LIBRARY
+int el_demo_print_options(void)
+#else
int main(void)
+#endif
{
struct el opts;
diff --git a/examples/print-simple.c b/examples/print-simple.c
index 4c28751..0c679f8 100644
--- a/examples/print-simple.c
+++ b/examples/print-simple.c
@@ -5,7 +5,11 @@
#include "embedlog.h"
+#ifdef EMBEDLOG_DEMO_LIBRARY
+int el_demo_print_simple(void)
+#else
int main(void)
+#endif
{
/* first we nned to initialize logger to known state, embedlog
* will print to stdout by default */
diff --git a/examples/print-thread-safe.c b/examples/print-thread-safe.c
index b8813d4..d1d3c55 100644
--- a/examples/print-thread-safe.c
+++ b/examples/print-thread-safe.c
@@ -5,7 +5,11 @@
#include "embedlog.h"
+#ifdef EMBEDLOG_DEMO_LIBRARY
+int el_demo_print_thread_safe(void)
+#else
int main(void)
+#endif
{
el_init();
diff --git a/examples/print-to-file.c b/examples/print-to-file.c
index b141e47..68d5b26 100644
--- a/examples/print-to-file.c
+++ b/examples/print-to-file.c
@@ -11,7 +11,11 @@
#define WORKDIR "/tmp/embedlog-example"
+#ifdef EMBEDLOG_DEMO_LIBRARY
+int el_demo_print_to_file(void)
+#else
int main(void)
+#endif
{
el_init();
el_option(EL_TS, EL_TS_LONG);
diff --git a/examples/print-tty.c b/examples/print-tty.c
index e483c14..ec90d01 100644
--- a/examples/print-tty.c
+++ b/examples/print-tty.c
@@ -6,7 +6,11 @@
#include "embedlog.h"
#include <termios.h>
+#ifdef EMBEDLOG_DEMO_LIBRARY
+int el_demo_print_tty(void)
+#else
int main(void)
+#endif
{
/* first we nned to initialize logger to known state */
el_init();