Hello there! Thank you for your quick response:
Right now, the way we're trying to solve this is by using dlsym() to look for functions that are included in one API version, and not another. This isn't quite as easy as using a version number, but is what we will do to tell the difference between, e.g. 2.7.1 and 3.0.0.
Either of your solutions will work here, I have no preference. And we are indeed generating functions and types from within Julia, on the fly, based on the entries of nettle_hashes[]. Fun times! -E
On Fri, May 1, 2015 at 12:05 PM, Niels Möller nisse@lysator.liu.se wrote:
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:
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; }
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
-- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance.