manywaypark's Blog
개발, 검색, 함수

'bif'에 해당되는 글 1건

  1. 2013.11.09 [펌] Erlang BIF 만들기

[펌] Erlang BIF 만들기

함수형 언어/Erlang 2013. 11. 9. 22:33 by manywaypark

steps

1. run configure
2. add your bifs to erts/emulator/beam/bif.tab

bif re:grep/2 bif re:compile/1

3. create a C file

erts/emulator/beam/erl_bif_re.c

4. add your C file to erts/emulator/<arch>/Makefile

RUN_OBJS = $(OBJDIR)/erl_bif_re.o \

5. implement your bifs by stealing bits from existing erl_bif_*.c files
1
2
3
4
5
BIF_RETTYPE re_grep_2(BIF_ALIST_2){
  Eterm result;
  result = magic_function();
  BIF_RET(result);
}
6. run make; make install

notes

  • steps 0-3 need only be done once.
  • note that if you add
1
bif re:grep/2

to bif.tab there should be a erl_bif_re.c that implements

1
BIF_RETTYPE re_grep_2(BIF_ALIST_2);


from: https://erlangcentral.org/wiki/index.php/Adding_my_own_BIF


happy hackin'

1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-24 08:20