Skip to content

Commit a7f7156

Browse files
authored
fix: add missing exports (#311)
1 parent 8c02e1e commit a7f7156

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out)
2121

2222
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU")
2323
list(APPEND uvwasi_cflags -fvisibility=hidden --std=gnu89)
24+
add_compile_definitions(NEED_UVWASI_EXPORT)
25+
2426
list(APPEND uvwasi_cflags -Wall -Wsign-compare -Wextra -Wstrict-prototypes)
2527
list(APPEND uvwasi_cflags -Wno-unused-parameter)
2628
endif()

include/wasi_serdes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
/* Basic uint{8,16,32,64}_t read/write functions. */
77

88
#define BASIC_TYPE(name, type) \
9+
UVWASI_EXPORT \
910
void uvwasi_serdes_write_##name(void* ptr, size_t offset, type value); \
11+
UVWASI_EXPORT \
1012
type uvwasi_serdes_read_##name(const void* ptr, size_t offset); \
1113

1214
#define BASIC_TYPE_UVWASI(type) BASIC_TYPE(type, uvwasi_##type)
@@ -83,15 +85,18 @@ BASIC_TYPE_UVWASI(whence_t)
8385
/* WASI structure read/write functions. */
8486

8587
#define STRUCT(name) \
88+
UVWASI_EXPORT \
8689
void uvwasi_serdes_write_##name(void* ptr, \
8790
size_t offset, \
8891
const uvwasi_##name* value); \
92+
UVWASI_EXPORT \
8993
void uvwasi_serdes_read_##name(const void* ptr, \
9094
size_t offset, \
9195
uvwasi_##name* value);
9296

9397
/* iovs currently only need to be read from WASM memory. */
9498
#define IOVS_STRUCT(name) \
99+
UVWASI_EXPORT \
95100
uvwasi_errno_t uvwasi_serdes_read_##name(const void* ptr, \
96101
size_t end, \
97102
size_t offset, \

include/wasi_types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,10 @@ typedef uint8_t uvwasi_whence_t;
322322
#define UVWASI_WHENCE_CUR 1
323323
#define UVWASI_WHENCE_END 2
324324

325-
#if defined(_WIN32) || defined(__CYGWIN__)
326-
#define UVWASI_EXPORT
327-
#else
325+
#ifdef NEED_UVWASI_EXPORT
328326
#define UVWASI_EXPORT __attribute__((visibility("default")))
329-
#endif
327+
#else
328+
#define UVWASI_EXPORT
329+
#endif /* NEED_UVWASI_EXPORT */
330330

331331
#endif /* __UVWASI_WASI_TYPES_H__ */

0 commit comments

Comments
 (0)