diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 9 | ||||
-rw-r--r-- | examples/example1.c | 31 |
2 files changed, 40 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..de2a394 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,9 @@ + +noinst_PROGRAMS = example1 + + +example1_SOURCES = example1.c +example1_CFLAGS = $(LIBOIL_CFLAGS) +example1_LDFLAGS = $(LIBOIL_LIBS) + + diff --git a/examples/example1.c b/examples/example1.c new file mode 100644 index 0000000..61e24ed --- /dev/null +++ b/examples/example1.c @@ -0,0 +1,31 @@ + +#include <liboil/liboil.h> +#include <stdio.h> +#include <stdlib.h> + + + +int main(int argc, char *argv[]) +{ + double *dest; + int32_t *src; + int i; + + oil_init(); + + src = malloc(100*sizeof(int32_t)); + dest = malloc(100*sizeof(double)); + + for(i=0;i<100;i++){ + src[i] = i; + } + + conv_f64_s32 (dest, sizeof(double), src, sizeof(int32_t), 100); + + for(i=0;i<100;i++){ + printf("%d %g\n",src[i],dest[i]); + } + + return 0; +} + |