<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">A good guess is that the as/wrap definitions in wrappers.h are the culprit (<a href="https://github.com/dahtah/imager/blob/master/inst/include/wrappers.h" class="">https://github.com/dahtah/imager/blob/master/inst/include/wrappers.h</a>).  Try declaring them as inline, or separating the definition from the declaration.<div class=""><br class=""></div><div class="">—Kevin</div><div class=""><br class=""></div><div style=""><blockquote type="cite" class=""><div class="">On Jul 17, 2015, at 7:32 AM, Simon Barthelmé <<a href="mailto:simon.barthelme@gipsa-lab.fr" class="">simon.barthelme@gipsa-lab.fr</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Dear list,<br class=""><br class="">For a package I'm developing (<a href="https://github.com/dahtah/imager/" class="">https://github.com/dahtah/imager/</a>) I had to write custom "as" and "wrap" functions for third-party classes. I'd like to make these wrappers accessible to other developers via inline C++ as well as LinkingTo directives (so that they can be used in other packages).<br class="">So far I've only managed the former: I have a header file in inst/include, called "wrappers.h", that contains the full implementations of my custom as and wrap functions. I've written a custom inline plugin and everything works fine. However, LinkingTo doesn't work: wrappers.h gets included in multiple object files and I get linking errors (the linker complains about multiple declarations of "as" and "wrap").<br class="">I understand RcppArmadillo manages to get around the problem but I can't figure out how. What's the correct way of doing this? Is there a way of making as and wrap inline functions so that it's safe to have header-only implementations?<br class=""><br class="">Thanks!<br class=""><br class="">Simon Barthelme<br class=""><br class="">_______________________________________________<br class="">Rcpp-devel mailing list<br class=""><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" class="">Rcpp-devel@lists.r-forge.r-project.org</a><br class="">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel<br class=""></div></blockquote></div><br class="">
<br class=""></body></html>