Skip to content

Commit c004a54

Browse files
committed
Add iBeacon ABI export shims
1 parent 87f4ab0 commit c004a54

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// Exports.swift
3+
// IBeacon
4+
//
5+
// ABI export shims. These live in the plugin's own module because `@_expose(wasm)` symbols are
6+
// dropped when they come from a dependency module (swiftlang/swift#77812). Copied unchanged from
7+
// the SDK template, with only the capability shims this plugin implements.
8+
//
9+
10+
import BLEPluginSDK
11+
12+
@_expose(wasm, "bleplug_abi_1")
13+
@_cdecl("bleplug_abi_1")
14+
func bleplugABIMarker() {}
15+
16+
@_expose(wasm, "bleplug_alloc")
17+
@_cdecl("bleplug_alloc")
18+
func bleplugAlloc(_ size: UInt32) -> UInt32 {
19+
PluginRuntime.allocate(size)
20+
}
21+
22+
@_expose(wasm, "bleplug_free")
23+
@_cdecl("bleplug_free")
24+
func bleplugFree(_ pointer: UInt32, _ size: UInt32) {
25+
PluginRuntime.deallocate(pointer)
26+
}
27+
28+
@_expose(wasm, "bleplug_parse_manufacturer")
29+
@_cdecl("bleplug_parse_manufacturer")
30+
func bleplugParseManufacturer(_ pointer: UInt32, _ length: UInt32) -> UInt64 {
31+
PluginRuntime.handle(pointer: pointer, length: length, parse: parseManufacturerData)
32+
}

0 commit comments

Comments
 (0)