In order to compile the Erlang linked-in driver on Darwin, we must specify some options when it will be linked. If you don't specify these options, you might see errors is as follows:
% gcc -o my_drv.dymlib my_drv.c -dynamiclib -fpic
/usr/bin/ld: Undefined symbols:
_driver_alloc
_driver_free
_driver_output
That's invalid, so it must specify some options below in order to create the shared object.
% gcc -o my_drv.so my_drv.c -bundle -flat_namespace -udefined suppress
see README in source code of Erlang/OTP for more details.