GeezerVison is showing github.com — Expose `swjs_library_features` from Swift side · ken0nek/JavaScriptKit@1336270
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: Sources/JavaScriptKit/Features.swift +4-8Lines changed: 4 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,17 +2,13 @@ enum LibraryFeatures { |
2 | 2 | static let weakRefs: Int32 = 1 << 0 |
3 | 3 | } |
4 | 4 |
|
5 | | -@_cdecl("_library_features") |
6 | | -func _library_features() -> Int32 { |
| 5 | +@_expose(wasm, "swjs_library_features") |
| 6 | +@_cdecl("_swjs_library_features") |
| 7 | +@available(*, unavailable) |
| 8 | +public func _swjs_library_features() -> Int32 { |
7 | 9 | var features: Int32 = 0 |
8 | 10 | #if !JAVASCRIPTKIT_WITHOUT_WEAKREFS |
9 | 11 | features |= LibraryFeatures.weakRefs |
10 | 12 | #endif |
11 | 13 | return features |
12 | 14 | } |
13 | | - |
14 | | -#if compiler(>=6.0) && hasFeature(Embedded) |
15 | | -// cdecls currently don't work in embedded, and expose for wasm only works >=6.0 |
16 | | -@_expose(wasm, "swjs_library_features") |
17 | | -public func _swjs_library_features() -> Int32 { _library_features() } |
18 | | -#endif |
Collapse file
Copy file name to clipboardExpand all lines: Sources/_CJavaScriptKit/_CJavaScriptKit.c -7Lines changed: 0 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,13 +46,6 @@ void swjs_free_host_function(const JavaScriptHostFuncRef host_func_ref) { |
46 | 46 | _free_host_function_impl(host_func_ref); |
47 | 47 | } |
48 | 48 |
|
49 | | -int _library_features(void); |
50 | | - |
51 | | -__attribute__((export_name("swjs_library_features"))) |
52 | | -int swjs_library_features(void) { |
53 | | - return _library_features(); |
54 | | -} |
55 | | - |
56 | 49 | int swjs_get_worker_thread_id_cached(void) { |
57 | 50 | _Thread_local static int tid = 0; |
58 | 51 | if (tid == 0) { |
|