Erlang Central

Adding my own BIF

Revision as of 16:56, 31 July 2006 by Rvirding (Talk | contribs)

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

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

3. create a C file


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
  Eterm result;
  result = magic_function(); 
6. run make; make install

steps 0-3 need only be done once.

note that if you add bif re:grep/2 to there should be a erl_bif_re.c that implements BIF_RETTYPE re_grep_2(BIF_ALIST_2);