charto / nbind

:sparkles: Magical headers that make your C++ library accessible from JavaScript :rocket:
MIT License
1.98k stars 119 forks source link

Looking for suggestions on how to debug dynCall_ifff not found #63

Closed tyduptyler13 closed 7 years ago

tyduptyler13 commented 7 years ago

Currently I have an issue with emscripten telling me that dynCall_ifff does not exist for Vector3 constructor.

Error: dynCall_ifff not found for Vector3 constructor(uint32_t, float32_t, float32_t, float32_t)
    at Object.getDynCall (nbind.js:1)
    at Object.makeCaller (nbind.js:1)
    at BindClass.registerMethods (nbind.js:1)
    at BindClass.registerSuperMethods (nbind.js:1)
    at BindClass.finish (nbind.js:1)
    at __nbind_finish (nbind.js:1)
    at st (nbind.js:15)
    at rt (nbind.js:15)
    at Object.ccallFunc [as ccall] (nbind.js:1)
    at Object.onRuntimeInitialized (nbind.js:1)

Which is odd because it really shouldn't exist, so I don't know why it is looking for it.

My Vector3 constructors:

NBIND_CLASS(Vector3f, Vector3) {
    construct<>();
    construct<float, float, float>();
    construct<Vector3f>();

Is this a problem with my code, nbind, or emscripten and how should I go about fixing/debugging it?

I can supply any other info you think might be relevant.

(Possibly relevant info: This exact code works fine for a standard node binding build).

tyduptyler13 commented 7 years ago

Ok, Digging pretty deep into this looks like that dyncall could be expected assuming the first uint is the this pointer and the other values are the parameters. All other functions also have a leading uint32 value so this makes sense.

The problem arises from the fact that Module doesn't expose dynCall_ifff, in fact, none of the dynCall names in module have float values. There are double values, but not float. It appears that emscripten does not enable float values to be passed or at least does not automatically convert them.

tyduptyler13 commented 7 years ago

I am going to try compiling with the latest emscripten and see how that goes.

tyduptyler13 commented 7 years ago

Further investigation shows that this is definitely a nbind related issue. Changing the emscripten compiler did nothing to change the behavior, and following the javascript side of things shows that the call for this non-existent function originates from nbind code. (em-api.js:1269)

I can find a stack trace of things if it would help.

jjrv commented 7 years ago

It should work now in master. Add a comment here if there's still problems. I'll do a release on Monday.