[erlang-questions] HIPE and on_load

Kostis Sagonas kostis@REDACTED
Mon Mar 6 15:51:01 CET 2017

On 03/06/17 16:45, Caragea Silviu wrote:
> Hello,
> When I compile using HIPE: ERL_COMPILER_OPTIONS="[native,{hipe, [o3]}]"
> All dependencies using NIF's are failing to compile:
> <HiPE (v 3.15.3)> EXITED with reason {'trans_fun/2',on_load}
> @hipe_beam_to_icode:1148
> Is this an expected behavior or anything I can do to bypass this ?

Yes, this is expected behaviour.

The on_load attribute instructs the BEAM loader to do its magic when 
loading this module (typically containing NIFs).  Files containing NIFs 
typically only contain very minimal Erlang code so they do not benefit 
much from native code compilation anyway.  So simply do not compile them 
to native code.

Perhaps adding an attribute


on the source of the file will solve the problem?


More information about the erlang-questions mailing list