From cc7cd15efaba131ccb9e169778928c9d7f27d098 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 14 Nov 2018 19:15:58 +0100 Subject: [PATCH] Test lib with makefile 640*480*4 bytes are a lot to process one-by-one --- libpxc/.gitignore | 3 +++ libpxc/makefile | 10 ++++++++++ libpxc/pxc.c | 19 +++++++++++++++++++ libpxc/pxct.c | 15 +++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 libpxc/.gitignore create mode 100644 libpxc/makefile create mode 100644 libpxc/pxc.c create mode 100644 libpxc/pxct.c diff --git a/libpxc/.gitignore b/libpxc/.gitignore new file mode 100644 index 0000000..4f3a132 --- /dev/null +++ b/libpxc/.gitignore @@ -0,0 +1,3 @@ +obj/ +out/ + diff --git a/libpxc/makefile b/libpxc/makefile new file mode 100644 index 0000000..c695180 --- /dev/null +++ b/libpxc/makefile @@ -0,0 +1,10 @@ +CC=gcc +# CFLAGS=-I. + +pxct: pxct.c pxc + $(CC) -Wall pxct.c -Lout -lpxc -Wl,-rpath=out -o out/pxct + +pxc: pxc.c + $(CC) -Wall -c -fpic pxc.c -o obj/pxc.o + $(CC) -Wall -shared obj/pxc.o -o out/libpxc.so + diff --git a/libpxc/pxc.c b/libpxc/pxc.c new file mode 100644 index 0000000..176f1a0 --- /dev/null +++ b/libpxc/pxc.c @@ -0,0 +1,19 @@ +#include + +int convert(int px[], int *out[]) { + printf("convert...\n"); + return 0; +} + +void __attribute__ ((constructor)) initLibrary(void) { + // + // Function that is called when the library is loaded + // + printf("Library is initialized\n"); +} +void __attribute__ ((destructor)) cleanUpLibrary(void) { + // + // Function that is called when the library is »closed«. + // + printf("Library is exited\n"); +} diff --git a/libpxc/pxct.c b/libpxc/pxct.c new file mode 100644 index 0000000..a23e5b3 --- /dev/null +++ b/libpxc/pxct.c @@ -0,0 +1,15 @@ +#include + +/* https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html +gcc -Wall -c -fpic pxc.c +gcc -Wall -shared pxc.o -o pxc.so +gcc -Wall pxct.c -L. -lpxc -Wl,-rpath=. +*/ + +int convert(int px[], int *out[]); + +int main() { + convert(NULL, NULL); + return 0; +} +