This change moves the NIF load from the time at which the module is
loaded to the time when a I2C actually is used.
The primary motivation for doing this is to defer native code crashes
from happening at load time to the time of first use. Load time is
harder to debug and sometimes its not clear which NIF caused the crash.
The calls to apply get around some complexity with ignoring Dialyzer
warnings. Dialyzer can't figure out that the recursive looking call
actually invokes the NIF code.
This change moves the NIF load from the time at which the module is loaded to the time when a I2C actually is used.
The primary motivation for doing this is to defer native code crashes from happening at load time to the time of first use. Load time is harder to debug and sometimes its not clear which NIF caused the crash.
The calls to
apply
get around some complexity with ignoring Dialyzer warnings. Dialyzer can't figure out that the recursive looking call actually invokes the NIF code.