Why is version not exported from `ei.h`?

Not really sure what the best category for this topic, but here goes…

I found this weekend about the Erl_Interface (ei.h) and decided it would be cool to have it in my go-to Scheme implementation. I started writing a wrapper library and found it weird that the version constant (131 currently) isn’t declared/defined in the header file. I wonder why?

ei_get_type returns the version as type, but given that it’s not any one of the defined type constants, one has to guess/trust/believe(?) it must be the version?

3 Likes

This version defined only in internal lib/erl_interface/src/misc/eiext.h file, but I have the same question - why this number not in public headers to get it for some inner checks, for example? Or this is not a subject to change anymore?

I opened an issue asking about this some months ago and forgot to update this. I’ll quote the last comment from there and mark the thread as solved.

You’re saying one should instead call ei_decode_version() before any other ei_get_type()/ei_decode_*(). Is that the intended usage of the library?

Yes.