R as a shared library