[Rcpp-devel] Integrating C-library libmseed to R

Christian Gunning xian at unm.edu
Wed Jul 13 12:33:00 CEST 2016


On 12 July 2016 at 19:33, Leo Leo wrote:

> | Dear Rcpp_devel enthusiats,
> |
> | May I ask you for exploiting your potential? I am working on a package to
> | handle seismic data (https://github.com/coLeo Leo <
> <https://github.com/coffeemuggler/eseis>behelfsadresse at googlemail.com>
> Cffeemuggler/eseis <https://github.com/coffeemuggler/eseis>).
> |
> | A key task is to be able to read and write the so called miniseed
> format. There
> | is a C-library for this job (
> https://seiscode.iris.washington.edu/projects/
> | libmseed/files).
> |
> | What would be needed to implement this library to my package? The goal
> would be
> | to have functions like read_mseed(file, ...) and write_mseed(data, file,
> ...).
> | According to the library documentation the functions that do this are
> | ms_readmsr(3) and ms_readtraces(3) as well as mst_pack(3) and
> mst_writemseed
> | (3).
>
> The very simplest option is probably to just copy the content of the
> library
> itself -- ie the *.c (or *.cpp) and *h files -- to your package's src/
> directory.  That way the content is present and can be used by your add-on
> functions.
>
> A slightly better and more involved option is to keep it in a subdirectory
> and have it built, say during configure.  You package then points to that
> (static) library from its src/Makevars.
>
> There are other options. But all this somehow requires you to know a little
> bit about library building, which then becomes OS-dependent as this is
> different between Linux and OS X, not to mention Windows.
>
> --
> A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
>

To add to Dirk's comments, a few questions to ask yourself:

* What is the license of libmseed?  Do you have permission to incorporate
it directly into your package?
* What is the license of your package?  Is it compatible with the license
of libmseed for incorporation?

* What are your platform requirements?  Do you want as broad an audience as
possible, or is this a project for a specific group that needs support on a
particular platform?  (As Dirk suggests, POSIX is the low-hanging fruit
here.  Also, have physical access to the platforms you plan to support is
very helpful).

* Minor language clarification: your original question asks "what would be
needed to implement" .  In software, the term "implement" commonly implies
"write anew".  My reading of your question is that you want to write as
little new code as possible, and re-use pre-existing code - is this
correct?  Again, the ability to directly incorporate other library code
into your package depends in some part on the licenses of both projects.

-hth
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160713/c3ae656f/attachment.html>


More information about the Rcpp-devel mailing list