feat: add swift from go

This commit is contained in:
2025-07-18 22:47:41 +08:00
parent c68d63fe52
commit ebb2161ca4
8 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
@_cdecl("sayHello") // export to C as `sayHello``
public func sayHello(namePtr: UnsafePointer<CChar>?) {
// Creates a new string by copying the null-terminated UTF-8 data (C String)
// referenced by the given pointer.
let name = String(cString: namePtr!)
print("Welcome, \(name)!")
}