File tree Expand file tree Collapse file tree
PluginSDK/Examples/BatteryLevel/Sources/BatteryLevel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //
2+ // Exports.swift
3+ // BatteryLevel
4+ //
5+ // ABI export shims. These live in the plugin's own module on purpose: `@_expose(wasm)` symbols
6+ // are dropped when they come from a dependency module (swiftlang/swift#77812), so the SDK ships
7+ // this file as template boilerplate rather than library code. Authors copy it unchanged and
8+ // delete the capability shims their plugin does not implement.
9+ //
10+
11+ import BLEPluginSDK
12+
13+ @_expose ( wasm, " bleplug_abi_1 " )
14+ @_cdecl ( " bleplug_abi_1 " )
15+ func bleplugABIMarker( ) { }
16+
17+ @_expose ( wasm, " bleplug_alloc " )
18+ @_cdecl ( " bleplug_alloc " )
19+ func bleplugAlloc( _ size: UInt32 ) -> UInt32 {
20+ PluginRuntime . allocate ( size)
21+ }
22+
23+ @_expose ( wasm, " bleplug_free " )
24+ @_cdecl ( " bleplug_free " )
25+ func bleplugFree( _ pointer: UInt32 , _ size: UInt32 ) {
26+ PluginRuntime . deallocate ( pointer)
27+ }
28+
29+ @_expose ( wasm, " bleplug_parse_characteristic " )
30+ @_cdecl ( " bleplug_parse_characteristic " )
31+ func bleplugParseCharacteristic( _ pointer: UInt32 , _ length: UInt32 ) -> UInt64 {
32+ PluginRuntime . handle ( pointer: pointer, length: length, parse: parseCharacteristic)
33+ }
You can’t perform that action at this time.
0 commit comments