I realized that one again I responded off list.  But yes my problem was fixed. I found the hard way that classes now require explicit constructors. <div>Thanks,</div><div>Andrew</div><div><div><br><div class="gmail_quote">
On Thu, Dec 2, 2010 at 1:42 PM, Romain Francois <span dir="ltr">&lt;<a href="mailto:romain@r-enthusiasts.com">romain@r-enthusiasts.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hmm. Actually my toy example was not right (it is getting late in france, I think I&#39;ve had enough screen time for one day). This works for me :<br>
<br>
require(inline)<br>
require(Rcpp)<br>
fx &lt;- cxxfunction(, &quot;&quot;, includes = &#39;<br>
<br>
    class Foo {<br>
    public:<br>
        Foo() : x(2.0){}<br>
        Foo(double x_) : x(x_){}<br>
        double foo(){ return 0.0 ; }<br>
<br>
    private:<br>
        double x ;<br>
    } ;<br>
<br>
    RCPP_MODULE(bar){<br>
<br>
        class_&lt;Foo&gt;(&quot;Foo&quot;)<br>
            .constructor()<br>
            .constructor&lt;double&gt;()<br>
            .method( &quot;foo&quot;, &amp;Foo::foo ) ;<br>
    }<br>
<br>
<br>
&#39;, plugin = &quot;Rcpp&quot; )<br>
m &lt;- Module( &quot;bar&quot;, getDynLib(fx), mustStart = TRUE )<br>
Foo &lt;- m$Foo<br>
new( Foo )<br>
<br>
Does the example work for you ?<br>
<br>
Romain<br>
<br>
Le 02/12/10 21:34, Romain Francois a écrit :<div><div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Apparently, creation of the object works, but the show method for the<br>
class has a problem, so you should be able to do:<br>
<br>
obj &lt;- new(Module(&quot;GPU_BAYES&quot;,&#39;gpuBayes&#39;)$data3)<br>
<br>
Can you confirm ? (I only tried on a toy example)<br>
<br>
but then when you print the object, it bombs out. I&#39;m narrowing this<br>
down, probably because of some oversight in the initialize method.<br>
<br>
Romain<br>
<br>
Le 02/12/10 20:36, Romain Francois a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That&#39;s odd that it only happens for your package. Guess #2 is that it<br>
might be a namespace issue. Can you try adding:<br>
<br>
import(methods)<br>
import(Rcpp)<br>
<br>
to your NAMESPACE file<br>
<br>
Romain<br>
<br>
Le 02/12/10 20:31, Andrew Redd a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That exposes the data3 class, but does not solve the pointer problem.<br>
<br>
On Thu, Dec 2, 2010 at 12:24 PM, Romain Francois<br>
&lt;<a href="mailto:romain@r-enthusiasts.com" target="_blank">romain@r-enthusiasts.com</a> &lt;mailto:<a href="mailto:romain@r-enthusiasts.com" target="_blank">romain@r-enthusiasts.com</a>&gt;&gt; wrote:<br>
<br>
Le 02/12/10 20:05, Andrew Redd a écrit :<br>
<br>
I updated to the new Rcpp 0.8.9 then added a new function to my<br>
class.<br>
It compiles fine the Module is found and loads the class<br>
definition<br>
seems to be there, but when I try to create a instance of the<br>
class I<br>
get the error:<br>
<br>
R&gt; new(Module(&quot;GPU_BAYES&quot;,&#39;gpuBayes&#39;)$data3)<br>
Error in get(&quot;.pointer&quot;, envir = env) : object &#39;.pointer&#39; not found<br>
<br>
Any Ideas what might be wrong here? That&#39;s a rather vague<br>
error. The<br>
traceback gives<br>
<br>
&gt; traceback()<br>
3: get(&quot;.pointer&quot;, envir = env)<br>
2: function (object)<br>
standardGeneric(&quot;show&quot;)(&lt;S4 object of class &quot;Rcpp_data3&quot;&gt;)<br>
1: function (object)<br>
standardGeneric(&quot;show&quot;)(&lt;S4 object of class &quot;Rcpp_data3&quot;&gt;)<br>
<br>
<br>
Thanks,<br>
Andrew<br>
<br>
<br>
In the Rcpp-modules vignette, that has been considerably updated in<br>
the last version of Rcpp (part of the 8661 new lines of code), we<br>
suggest to have this in your .onLoad:<br>
<br>
# grab the namespace<br>
NAMESPACE &lt;- environment()<br>
<br>
.onLoad &lt;- function(libname, pkgname){<br>
# load the module and store it in our namespace<br>
yada &lt;- Module( &quot;GPU_BAYES&quot; )<br>
populate( yada, NAMESPACE )<br>
}<br>
<br>
and the &quot;data3&quot; class is directly exposed in the namespace of your<br>
package, so that you can do:<br>
<br>
new( data3 )<br>
<br>
Does that work ?<br>
<br>
<br>
Otherwise, maybe you can try adding mustStart = TRUE to the call to<br>
Module.<br>
</blockquote></blockquote></blockquote>
<br>
<br>
-- <br>
Romain Francois<br>
Professional R Enthusiast<br>
+33(0) 6 28 91 30 30<br>
<a href="http://romainfrancois.blog.free.fr" target="_blank">http://romainfrancois.blog.free.fr</a><br>
|- <a href="http://bit.ly/hovakS" target="_blank">http://bit.ly/hovakS</a> : RcppGSL initial release<br>
|- <a href="http://bit.ly/iaxTdO" target="_blank">http://bit.ly/iaxTdO</a> : parser 0.0-12<br>
`- <a href="http://bit.ly/gnCl01" target="_blank">http://bit.ly/gnCl01</a> : Rcpp 0.8.9<br>
<br>
<br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
</div></div><div><div></div><div class="h5"><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>

</div></div></blockquote></div><br></div></div>