Open lygstate opened 6 years ago
code is:
import * as refNAPI from 'ref-napi'
import * as ref_struct_di from 'ref-struct-di'
import * as ref_array_di from 'ref-array-di'
export const ref = refNAPI
export const structType = ref_struct_di(ref)
export const arrayType = ref_array_di(ref)
// Some useful types.
export const boolPtr = ref.refType('bool')
export const uintPtr = ref.refType('uint')
export const uint8Ptr = ref.refType('uint8')
export const sizePtr = ref.refType('size_t')
export const stringPtr = ref.refType('string')
export const void_t = ref.types.void
export const voidPtr = ref.refType(void_t) // Pointer to an opaque LLVM value.
export const voidPtrPtr = ref.refType(voidPtr) // void**, used for arrays and out-parameters.
/**
* A constructor for arrays of pointers. Use this as `new PointerArray(N)` to
* create an array of length N.
*/
export const pointerArray = structType(voidPtr)
E:\CI-Cor\acrop\acop-mtk2503\node-clang-ffi\node_modules\ref-napi\lib\ref.js:400 if (!(rtn && 'size' in rtn && 'indirection' in rtn)) { ^ TypeError: Cannot use 'in' operator to search for 'size' in 2 at Object.coerceType (E:\CI-Cor\acrop\acop-mtk2503\node-clang-ffi\node_modules\ref-napi\lib\ref.js:400:23) at Function.defineProperty (E:\CI-Cor\acrop\acop-mtk2503\node-clang-ffi\node_modules\ref-struct-di\lib\struct.js:198:14) at E:\CI-Cor\acrop\acop-mtk2503\node-clang-ffi\node_modules\ref-struct-di\lib\struct.js:141:18 at Array.forEach ()
at Object.Struct [as structType] (E:\CI-Cor\acrop\acop-mtk2503\node-clang-ffi\node_modules\ref-struct-di\lib\struct.js:139:22)
at Object. (E:\CI-Cor\acrop\acop-mtk2503\node-clang-ffi\src\type.ts:22:29)
at Module._compile (module.js:643:30)
at Module.m._compile (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:402:23)
at Module._extensions..js (module.js:654:10)
at Object.require.extensions.(anonymous function) [as .ts] (C:\Users\lygstate\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:405:12)