Skip to content

Commit f4d5219

Browse files
Merge pull request #329 from swiftwasm/yt/fix-xcode-build
build: Fix native build for missing symbol
2 parents bad9706 + 4709005 commit f4d5219

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
runs-on: ${{ matrix.os }}
6565
steps:
6666
- uses: actions/checkout@v4
67-
- run: swift build
67+
- run: swift build --package-path ./Examples/Basic
6868
env:
6969
DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer/
7070

Sources/_CJavaScriptKit/_CJavaScriptKit.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#include "_CJavaScriptKit.h"
22
#if __wasm32__
3-
#ifndef __wasi__
4-
#if __has_include("malloc.h")
5-
#include <malloc.h>
6-
#endif
3+
# ifndef __wasi__
4+
# if __has_include("malloc.h")
5+
# include <malloc.h>
6+
# endif
77
extern void *malloc(size_t size);
88
extern void free(void *ptr);
99
extern void *memset (void *, int, size_t);
1010
extern void *memcpy (void *__restrict, const void *__restrict, size_t);
11-
#else
12-
#include <stdlib.h>
13-
#include <stdbool.h>
11+
# else
12+
# include <stdlib.h>
13+
# include <stdbool.h>
1414

15-
#endif
15+
# endif
1616
/// The compatibility runtime library version.
1717
/// Notes: If you change any interface of runtime library, please increment
1818
/// this and `SwiftRuntime.version` in `./Runtime/src/index.ts`.
@@ -34,7 +34,7 @@ void swjs_cleanup_host_function_call(void *argv_buffer) {
3434
// NOTE: This __wasi__ check is a hack for Embedded compatibility (assuming that if __wasi__ is defined, we are not building for Embedded)
3535
// cdecls don't work in Embedded, but @_expose(wasm) can be used with Swift >=6.0
3636
// the previously used `#if __Embedded` did not play well with SwiftPM (defines needed to be on every target up the chain)
37-
#ifdef __wasi__
37+
# ifdef __wasi__
3838
bool _call_host_function_impl(const JavaScriptHostFuncRef host_func_ref,
3939
const RawJSValue *argv, const int argc,
4040
const JavaScriptObjectRef callback_func);
@@ -59,6 +59,8 @@ __attribute__((export_name("swjs_library_features")))
5959
int swjs_library_features(void) {
6060
return _library_features();
6161
}
62+
# endif
63+
#endif
6264

6365
int swjs_get_worker_thread_id_cached(void) {
6466
_Thread_local static int tid = 0;
@@ -67,5 +69,3 @@ int swjs_get_worker_thread_id_cached(void) {
6769
}
6870
return tid;
6971
}
70-
#endif
71-
#endif

0 commit comments

Comments
 (0)