<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Kevin <br>
<br>
Thanks for your answer. I've tried declaring them as inline but the
compiler (clang, haven't tried gcc) issues a warning saying it's
going to ignore the inline statement. I'm assuming this is because
the declaration is actually a template specialisation but I haven't
found a definitive answer. <br>
If I separate the declaration from the definition, the linker now
complains as and wrap are missing. Using the interface:: attribute
doesn't seem to help either. <br>
<br>
Best<br>
<br>
Simon<br>
<br>
<div class="moz-cite-prefix">Le 17/07/2015 16:56, Kevin Thornton a
écrit :<br>
</div>
<blockquote cite="mid:2CFB588D-6B92-42FC-B5DE-5658C949DC04@uci.edu"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
A good guess is that the as/wrap definitions in wrappers.h are the
culprit (<a moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:Rcpp-devel@lists.r-forge.r-project.org"
class="">Rcpp-devel@lists.r-forge.r-project.org</a><br
class="">
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br
class="">
</div>
</blockquote>
</div>
<br class="">
<br class="">
</blockquote>
<br>
</body>
</html>