cucapra / node-llvmc

JavaScript/TypeScript FFI bindings for the LLVM C API
MIT License
12 stars 7 forks source link

Ref array types as alternative to pointers #1

Open rhenwood39 opened 7 years ago

rhenwood39 commented 7 years ago

In llvm2, ref array types were used in places where this project used pointers (e.g. voidpp, int pointers, etc).

See https://github.com/dirk/llvm2/blob/master/lib/ref-types.js for definition of array types.

See https://github.com/dirk/llvm2/blob/master/lib/library.js for use of array types.

rhenwood39 commented 7 years ago

It looks like we are going to have to use PointerArrays instead of voidpp and the like. We'll have to go through llvm.ts and see which functions are currently using pointer arguments when they should be using array arguments.

sampsyo commented 7 years ago

Yes, good point. I think it's technically possible for voidpp to work if the user carefully constructs their own Buffer full of pointer-sized numbers, but the new array types are certainly more ergonomic.