radare / valabind

create bindings from vapi to nodejs, python, swig, c++
GNU General Public License v3.0
56 stars 27 forks source link

[node-ffi] TypeError: error setting argument 0 - valabind [StructType]#set got a bad value #22

Open 3demax opened 10 years ago

3demax commented 10 years ago

I've generated binding for tox, but

/home/user/node-tox-ffi/node_modules/ffi/lib/_foreign_function.js:55
      throw e
            ^
TypeError: error setting argument 0 - valabind [StructType]#set got a bad value
    at Function.set (/home/user/node-tox-ffi/tox_custom.js:65:10)
    at Object.set (/home/user/node-tox-ffi/node_modules/ref/lib/ref.js:479:10)
    at Object.alloc (/home/user/node-tox-ffi/node_modules/ref/lib/ref.js:513:13)
    at ForeignFunction.proxy (/home/user/node-tox-ffi/node_modules/ffi/lib/_foreign_function.js:50:22)
    at StructType.size (/home/user/node-tox-ffi/tox_custom.js:141:13)
    at Object.<anonymous> (/home/user/node-tox-ffi/tox_custom.js:338:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

I'm trying to understand this types system, and it's very complicated. Can you please explain, what's wrong here?

msmaromi commented 10 years ago

I have the same issue. May someone explain this?

radare commented 10 years ago

Can you provide a simpler test case and (vapi+makefile) to reproduce the issue? I guess that's related to a wrongly defined vapi file. did you tested it with Vala?

msmaromi commented 10 years ago

I've recheck my case and it turns out a different problem. Thankyou anyway

futurepaycc commented 3 years ago

same error

os: linux-x64 vala: 0.50 valabind: 1.7.2 nodejs: v10.22.1 github.com/antono/vala-object node example (updated node ffi ...)

futurepaycc commented 3 years ago

figured out:

nodeffiwriter.vala: 395,397

val.buffer -> val['ref.buffer']

trufae commented 3 years ago

Awesome! Can you send a PR? Just pressing the pencil button in github allows you to edit the file and create the pr automatically.

I will setup the CI for further testimg too

Thanks!!