Movatterモバイル変換


[0]ホーム

URL:


Tuesday,November8,2016

Passing an Array of Strings From Swift to C

Ole Begemann:

The type checker allows you topass aString value to anUnsafePointer<Int8> orUnsafePointer<UInt8> parameter. When you do that, the compiler will transparently create a buffer containing the UTF-8-encoded, null-terminated string, and pass a pointer to that buffer to the function.

[…]

However, some C functions take an array of strings (achar ** orchar *[]), and there is no built-in support in Swift for passing a[String] to achar ** parameter.

[…]

The full type of thestrlen function as imported by Swift looks like this[…]

1 CommentRSS ·Twitter


Michael Tsai - Blog - Unsafe Swift: Using Pointers and Interacting With C
January 7, 2017 8:19 AM

[…] Passing an Array of Strings From Swift to C, Swift 3.0 Unsafe World, Swift and C […]

Leave a Comment

  

Black Friday
Blog
Archives
Tag Cloud
Top Posts

Recently Updated
RSS Feed ·Comments
Mastodon ·Twitter
Apple News
Trackback

Support this site viaPatreon.

Try my Mac apps:

DropDMGDropDMGDropDMG
EagleFilerEagleFilerEagleFiler
SpamSieveSpamSieveSpamSieve
ToothFairyToothFairyToothFairy
Copyright © 2000–2025Michael Tsai.

[8]ページ先頭

©2009-2025 Movatter.jp