Open frekw opened 7 years ago
The catch is supposed to be there - if your NIF isn't compiled correctly, or not available, and you are including/using the library module in your code, you want this to fail. Or have I missed something?
Yes, but the catch silences the failure to load the NIF. So during application start it appears as if everything has loaded properly but all calls fail with snappy_nif_not_loaded
and you don't get any indication as to why.
@frekw the try/catch is in place because this code was originally written when not all versions of erlang could support NIFs, and the parent library then would need to handle it. I think now we can safely remove this check completely.
Hi!
Just having spent some time trying to understand why
snappy-erlang-nif
failed to load on my production system, could I suggest either removing thecatch
here: https://github.com/fdmanana/snappy-erlang-nif/blob/master/src/snappy.erl#L36 or making it optional? :)Unfortunately, my Erlang chops are a pretty much non-existant, otherwise I'd send a pull request.
Best, Fredrik