Elliot Saba staticfloat@gmail.com writes:
I maintain the Julia language bindings for Nettle https://github.com/staticfloat/Nettle.jl which loads the dynamic library and generates methods to use Nettle's cryptographic functions on the fly.
Nice!
This process does not use header files, it's similar to Python's ctypes functionality, and thus knowing which API version we're dealing with by only using the dynamic library itself is necessary.
To some degree, I imagine you can solve the problem by looking up the symbols of interest using dlsym, and skip generation of corresponding julia methods if the symbol doesn't exist (but that won't help when there are incompatible changes to the behaviour) . You might also want to use the list
extern const struct nettle_hash * const nettle_hashes[];
(declared in nettle-meta.h).
Most other projects have some method or other for determining this, as you guys have already discussed, but simply placing the information into a header file is not sufficient for this use case.
I understand that a runtime method to look up the version of nettle can be useful in some cases. What level of detail do you need? Some alternatives:
1. Functions just returning the corresponding version.h values, like
int nettle_version_major (void) { return NETTLE_VERSION_MAJOR; }
int nettle_version_minor (void) { return NETTLE_VERSION_MINOR; }
2. Some struct including version numbers and possibly other configure information,
struct nettle_version_info { int major; int minor; ... };
extern const struct nettle_version_info nettle_version;
It's no big deal to add something like this, but I'm not sure what's really needed.
Regards, /Niels