aboutsummaryrefslogtreecommitdiff
path: root/sokol_fetch.h
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2020-11-28 15:01:16 +0100
committerAndre Weissflog <floooh@gmail.com>2020-11-28 15:01:16 +0100
commit91529a79792ba669c9451c659e65e643540700bf (patch)
treeb264953e4d9ba3b4acec882cc76cef174a4670ad /sokol_fetch.h
parent78dd4e284027d9cdd9437c800bc4af570db8d032 (diff)
parent900df0ee04e4c0b9db7a5b2352c69a645394aa08 (diff)
Merge branch 'iboB-distinct_export_macros'
Diffstat (limited to 'sokol_fetch.h')
-rw-r--r--sokol_fetch.h45
1 files changed, 25 insertions, 20 deletions
diff --git a/sokol_fetch.h b/sokol_fetch.h
index 6872a4a2..6b56f258 100644
--- a/sokol_fetch.h
+++ b/sokol_fetch.h
@@ -16,7 +16,8 @@
SOKOL_FREE(p) - your own free function (default: free(p))
SOKOL_LOG(msg) - your own logging function (default: puts(msg))
SOKOL_UNREACHABLE() - a guard macro for unreachable code (default: assert(false))
- SOKOL_API_DECL - public function declaration prefix (default: extern)
+ SOKOL_FETCH_API_DECL - public function declaration prefix (default: extern)
+ SOKOL_API_DECL - same as SOKOL_FETCH_API_DECL
SOKOL_API_IMPL - public function implementation prefix (default: -)
SFETCH_MAX_PATH - max length of UTF-8 filesystem path / URL (default: 1024 bytes)
SFETCH_MAX_USERDATA_UINT64 - max size of embedded userdata in number of uint64_t, userdata
@@ -29,7 +30,7 @@
SOKOL_DLL
- On Windows, SOKOL_DLL will define SOKOL_API_DECL as __declspec(dllexport)
+ On Windows, SOKOL_DLL will define SOKOL_FETCH_API_DECL as __declspec(dllexport)
or __declspec(dllimport) as needed.
NOTE: The following documentation talks a lot about "IO threads". Actual
@@ -829,13 +830,17 @@
#include <stdint.h>
#include <stdbool.h>
-#ifndef SOKOL_API_DECL
+#if defined(SOKOL_API_DECL) && !defined(SOKOL_FETCH_API_DECL)
+ #define SOKOL_FETCH_API_DECL SOKOL_API_DECL
+#endif
+
+#ifndef SOKOL_FETCH_API_DECL
#if defined(_WIN32) && defined(SOKOL_DLL) && defined(SOKOL_IMPL)
-#define SOKOL_API_DECL __declspec(dllexport)
+#define SOKOL_FETCH_API_DECL __declspec(dllexport)
#elif defined(_WIN32) && defined(SOKOL_DLL)
-#define SOKOL_API_DECL __declspec(dllimport)
+#define SOKOL_FETCH_API_DECL __declspec(dllimport)
#else
-#define SOKOL_API_DECL extern
+#define SOKOL_FETCH_API_DECL extern
#endif
#endif
@@ -904,35 +909,35 @@ typedef struct sfetch_request_t {
} sfetch_request_t;
/* setup sokol-fetch (can be called on multiple threads) */
-SOKOL_API_DECL void sfetch_setup(const sfetch_desc_t* desc);
+SOKOL_FETCH_API_DECL void sfetch_setup(const sfetch_desc_t* desc);
/* discard a sokol-fetch context */
-SOKOL_API_DECL void sfetch_shutdown(void);
+SOKOL_FETCH_API_DECL void sfetch_shutdown(void);
/* return true if sokol-fetch has been setup */
-SOKOL_API_DECL bool sfetch_valid(void);
+SOKOL_FETCH_API_DECL bool sfetch_valid(void);
/* get the desc struct that was passed to sfetch_setup() */
-SOKOL_API_DECL sfetch_desc_t sfetch_desc(void);
+SOKOL_FETCH_API_DECL sfetch_desc_t sfetch_desc(void);
/* return the max userdata size in number of bytes (SFETCH_MAX_USERDATA_UINT64 * sizeof(uint64_t)) */
-SOKOL_API_DECL int sfetch_max_userdata_bytes(void);
+SOKOL_FETCH_API_DECL int sfetch_max_userdata_bytes(void);
/* return the value of the SFETCH_MAX_PATH implementation config value */
-SOKOL_API_DECL int sfetch_max_path(void);
+SOKOL_FETCH_API_DECL int sfetch_max_path(void);
/* send a fetch-request, get handle to request back */
-SOKOL_API_DECL sfetch_handle_t sfetch_send(const sfetch_request_t* request);
+SOKOL_FETCH_API_DECL sfetch_handle_t sfetch_send(const sfetch_request_t* request);
/* return true if a handle is valid *and* the request is alive */
-SOKOL_API_DECL bool sfetch_handle_valid(sfetch_handle_t h);
+SOKOL_FETCH_API_DECL bool sfetch_handle_valid(sfetch_handle_t h);
/* do per-frame work, moves requests into and out of IO threads, and invokes response-callbacks */
-SOKOL_API_DECL void sfetch_dowork(void);
+SOKOL_FETCH_API_DECL void sfetch_dowork(void);
/* bind a data buffer to a request (request must not currently have a buffer bound, must be called from response callback */
-SOKOL_API_DECL void sfetch_bind_buffer(sfetch_handle_t h, void* buffer_ptr, uint32_t buffer_size);
+SOKOL_FETCH_API_DECL void sfetch_bind_buffer(sfetch_handle_t h, void* buffer_ptr, uint32_t buffer_size);
/* clear the 'buffer binding' of a request, returns previous buffer pointer (can be 0), must be called from response callback */
-SOKOL_API_DECL void* sfetch_unbind_buffer(sfetch_handle_t h);
+SOKOL_FETCH_API_DECL void* sfetch_unbind_buffer(sfetch_handle_t h);
/* cancel a request that's in flight (will call response callback with .cancelled + .finished) */
-SOKOL_API_DECL void sfetch_cancel(sfetch_handle_t h);
+SOKOL_FETCH_API_DECL void sfetch_cancel(sfetch_handle_t h);
/* pause a request (will call response callback each frame with .paused) */
-SOKOL_API_DECL void sfetch_pause(sfetch_handle_t h);
+SOKOL_FETCH_API_DECL void sfetch_pause(sfetch_handle_t h);
/* continue a paused request */
-SOKOL_API_DECL void sfetch_continue(sfetch_handle_t h);
+SOKOL_FETCH_API_DECL void sfetch_continue(sfetch_handle_t h);
#ifdef __cplusplus
} /* extern "C" */