Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref cause error:( #3

Open
lygstate opened this issue Apr 19, 2018 · 1 comment
Open

ref cause error:( #3

lygstate opened this issue Apr 19, 2018 · 1 comment

Comments

@lygstate
Copy link

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)

@lygstate
Copy link
Author

lygstate commented Apr 19, 2018

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant