BEAM documentation (was Re: Packages in Erlang...)

Scott Lystig Fritchie fritchie@REDACTED
Mon Sep 22 07:06:29 CEST 2003


>>>>> "lg" == Luke Gorrie <luke@REDACTED> writes:

lg> Aside from the BIFs, another issue is linked in drivers. Do you
lg> know how separable those are? In practice do you need to link some
lg> of them with BEAM'ey libraries or similar?

I faced that problem with EDTK's design goal to support both linked-in
and pipe drivers.  The source file edtk/erl_driver_pipelib.c contains
the functions that EDTK-generated drivers need.  This list is a first
draft of an upper limit on the functions a linked-in driver needs.  (A
bad, bad one could try calling just about anything inside BEAM using
dlsym().  :-)  Some of them aren't necessary, depending on the
communcation style the driver uses.  (Corollary: if you used a
different communcation style (there are several to choose from!), you
might need others.)

ErlIOVec *read_packet_make_iovec(int fd)
ErlDrvBinary *driver_alloc_binary(int size)
ErlDrvBinary *driver_realloc_binary(ErlDrvBinary *oldbin, int size)
void driver_free_binary(ErlDrvBinary *ebin)
void *sys_alloc(size_t size)
void sys_free(void *p)
int driver_output_term(ErlDrvPort ix, ErlDrvTermData* data, int len)
long driver_async(ErlDrvPort ix, unsigned int* key, void (*async_invoke)(void*), void* async_data, void (*async_free)(void*))
ErlDrvTermData driver_mk_atom(char *name)
ErlDrvTermData driver_mk_port(ErlDrvPort port)
int driver_select(ErlDrvPort port, ErlDrvEvent event, int mode, int on)

At the time, I was happy it was a small list.

-Scott



More information about the erlang-questions mailing list