wrapNativeObject

Wraps a struct by reference. The pointer is stored - be sure the struct doesn't get freed or go out of scope!

BTW: structs by value can be put in vars with var.opAssign and var.get. It will generate an object with the same fields. The difference is changes to the jsvar won't be reflected in the original struct and native methods won't work if you do it that way.

  1. WrappedNativeObject wrapNativeObject(Class obj)
  2. WrappedNativeObject wrapNativeObject(Struct* obj)
    ?
    WrappedNativeObject
    wrapNativeObject
    (
    Struct
    )
    (
    Struct* obj
    )
    if (
    is(Struct == struct)
    )

Meta

Suggestion Box / Bug Report