swog icon indicating copy to clipboard operation
swog copied to clipboard

Automatically transform String args to CString

Open jokade opened this issue 5 years ago • 1 comments

In classes annotated with CObj, CxxObj, or ObjC, we should optionally transform String args passed to external functions into a CString, using a local zone. I.e.

@CObj
class Foo {
  @transformArgs
  def foo(arg: String): Unit = extern

should be semantically equivalent to

def foo(arg: CString): Unit = extern
def foo(arg: String): Unit = Zone{ implicit z =>
  foo( toCString(arg) )
}

jokade avatar Oct 11 '20 07:10 jokade

see also https://github.com/scala-native/scala-native/issues/1940

jokade avatar Oct 11 '20 07:10 jokade