diff options
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/CMakeLists.txt | 4 | ||||
-rw-r--r-- | extensions/ext.c | 10 | ||||
-rw-r--r-- | extensions/ext.h | 18 | ||||
-rw-r--r-- | extensions/ext_hello.c | 14 |
4 files changed, 46 insertions, 0 deletions
diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt new file mode 100644 index 0000000..ed1a5e6 --- /dev/null +++ b/extensions/CMakeLists.txt @@ -0,0 +1,4 @@ +project(asdfapi_ext) +add_library(asdfapi_ext SHARED ext.c ext.h) +add_library(asdfapi_ext_hello SHARED ext_hello.c) +target_link_libraries(asdfapi_ext_hello asdfapi_ext)
\ No newline at end of file diff --git a/extensions/ext.c b/extensions/ext.c new file mode 100644 index 0000000..c46c9f9 --- /dev/null +++ b/extensions/ext.c @@ -0,0 +1,10 @@ +// +// Created by jhunk on 7/2/24. +// +#include "ext.h" + +int asdfapi_ext_new(struct ASDFExtension *ext, const char *name, const char *desc) { + ext->name = name; + ext->desc = desc; + return 0; +} diff --git a/extensions/ext.h b/extensions/ext.h new file mode 100644 index 0000000..8a52b90 --- /dev/null +++ b/extensions/ext.h @@ -0,0 +1,18 @@ +// +// Created by jhunk on 7/2/24. +// + +#ifndef ASDFAPI_EXT_H +#define ASDFAPI_EXT_H + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +struct ASDFExtension { + const char *name; // Name of extension + const char *desc; // Description of extension +}; + +int asdfapi_ext_new(struct ASDFExtension *ext, const char *name, const char *desc); +#endif //ASDFAPI_EXT_H diff --git a/extensions/ext_hello.c b/extensions/ext_hello.c new file mode 100644 index 0000000..d071c4f --- /dev/null +++ b/extensions/ext_hello.c @@ -0,0 +1,14 @@ +#include "ext.h" + +struct ASDFExtension asdfapi_ext_descriptor; + +int asdfapi_ext_say_hello(const char *msg) { + printf("HELLO FROM %s:%s!\nMessage: %s\n", __FILE_NAME__, __FUNCTION__, msg); + return 0; +} + +int asdfapi_ext_init() { + fprintf(stdout, "Initializing %s:%s\n", __FILE_NAME__ ,__FUNCTION__); + asdfapi_ext_new(&asdfapi_ext_descriptor, "Hello", "An extension that prints a hello message"); + return 0; +}
\ No newline at end of file |