escript를 직접 작성하면 nif를 사용할 수 있지만 철근 배근 escriptize를 사용하면 nif 함수를 찾을 수 없습니다. 나는 * .so 객체가 빔 파일처럼 압축되지 않기 때문이라고 생각합니다. 다음은 간단한 예입니다.철근 철근 escriptize & nifs
rebar.config
:
{deps, [
{'jiffy', "", {git, "https://github.com/davisp/jiffy.git", {branch, master}}}
]}.
{escript_incl_apps, [jiffy]}.
%% I tried this to see what happens if the so got in there but didn't help
{escript_incl_extra, [{"deps/jiffy/priv/jiffy.so", "/path/to/my/proj"}]}.
test.erl
:
-module(test).
-export([main/1]).
main(_Args) ->
jiffy:decode(<<"1">>),
ok.
철근은 escriptize
./test
를 컴파일 할 수-deps 결과는
escript: exception error: undefined function jiffy:decode/1
in function test:main/1 (src/test.erl, line 7)
in call from escript:run/2 (escript.erl, line 741)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_it/1
in call from init:start_em/1
입니다
이를 극복 할 방법이 있습니까?
오류로 인해 '* .so'가 아니라'jiffy.beam'이 발견되었습니다. 어쩌면'escriptize'는'ebin'의 의존성을 무시한'ebin'의 빔만을 고려했을지도 모릅니다. –
@ Ed'ka, 아니요. nif가 아닌 종속성을 추가하면 안됩니다. 제대로 작동합니다. – cashmere
그러나'jiffy.so'를'priv'에서 제거한 상태에서'jiffy : decode/1'을 호출하려고하면'undefined function'이 아니라'NIF library를로드하지 못했습니다 .'라는 오류 메시지가 나타납니다. –