charto / nbind

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

Documentation around unbound type errors when running ndts #118

Open ed-alertedh opened 6 years ago

ed-alertedh commented 6 years ago

I am attempting to port some of DCMTK - a fairly complex lib for working with DICOM files - to asm.js using nbind.

One of the main reasons I decided to try nbind was the ability to generate Typescript definitions. When I first started trying to use the ndts tool I got a lot of errors along the lines of "Error: Unbound type 762842? in DSRDocument.write" (see here for method signature). It turned out that all I had to do was bind the classes used in that method signature and even stubs were sufficient as a starting point, i.e.:

NBIND_CLASS(DcmItem) {}
NBIND_CLASS(OFCondition) {}
NBIND_CLASS(DcmStack) {}

If at all possible, it would be great if there was a way to embed the original type information into the asm.js output (in some kind of debug build) so that this error message can be more specific. If that isn't possible then a little documentation and perhaps a hint in the actual error message would be very helpful for people running into this error for the first time. I'm happy to assist if you have some recommendations around the best way to tackle this.

Also, thanks for building such a useful tool!