Jonas,<div>Thank you. This exactly solved the problem. I'm not sure if this `Module('yada','test')$bla()` causing a segmentation fault or not is a bug or user error. I'll leave that for Dirk and Romain to figure out. For now I'll chalk it up to a user error. Thanks for figuring this out.</div>
<div><br></div><div>-Andrew<br><br><div class="gmail_quote">On Tue, Jun 21, 2011 at 10:37 PM, Jonas Rauch <span dir="ltr"><<a href="mailto:jonas.rauch@googlemail.com">jonas.rauch@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I had the same problem before I realized that when a Module is loaded as part of a package (instead of manually loading the shared lib) you don't need the whole <font face="arial, sans-serif"><br>
> </font><font><font face="arial, sans-serif"><span style="border-collapse:collapse">Module('yada','test')$ ...<br>
just try <br>>bla()<br><br>The exposed classes and functions are automatically made available in the namespace of the package<br></span></font></font><font><font face="arial, sans-serif"><span style="border-collapse:collapse"></span></font></font><br>
<font><font face="arial, sans-serif"><span style="border-collapse:collapse"><div class="im">> library(test)<br>Loading required package: Rcpp<br></div>> test::<br>test::bar test::bla2 test::rcpp_hello_world<br>
test::bla test::foo test::World<br>test::bla1 test::hello <br><br>Regards,<br>Jonas<br><br><br><br></span></font></font><br><div class="gmail_quote"><div><div></div><div class="h5">
On Wed, Jun 22, 2011 at 12:51 AM, Andrew Redd <span dir="ltr"><<a href="mailto:amredd@gmail.com" target="_blank">amredd@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">I apologize if this has been covered. I've looked and see a couple of post relating to this issue, but I'm not sure if it was ever solved. The example modules appear to not work, at least for me. On a related note I can't get my modules to run either, but If I can figure out how to run the examples I think I can get mine running.<div>
<br></div><div>R> sessionInfo()<div>R version 2.13.0 (2011-04-13)</div><div>Platform: x86_64-pc-linux-gnu (64-bit)</div><div><br></div><div>locale:</div><div> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C </div>
<div> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 </div><div> [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 </div><div> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C </div><div> [9] LC_ADDRESS=C LC_TELEPHONE=C </div>
<div>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C </div><div><br></div><div>attached base packages:</div><div>[1] stats graphics grDevices utils datasets methods base </div><div><br></div><div>
other attached packages:</div><div>[1] Rcpp_0.9.4</div><div><div><br></div></div></div><div>To install the package skeleton:</div><div>$ r -lRcpp -e"Rcpp.package.skeleton(\"test\",module=T)"</div><div>
Attaching package: 'utils'</div><div><br></div><div>The following object(s) are masked from 'package:Rcpp':</div><div><br></div><div> .DollarNames, prompt</div><div><br></div><div>Creating directories ...</div>
<div>Creating DESCRIPTION ...</div><div>Creating NAMESPACE ...</div><div>Creating Read-and-delete-me ...</div><div>Saving functions and data ...</div><div>Making help files ...</div><div>Done.</div><div>Further steps are described in './test/Read-and-delete-me'.</div>
<div><br></div><div>Adding Rcpp settings</div><div> >> added RcppModules: yada</div><div> >> added Depends: Rcpp</div><div> >> added LinkingTo: Rcpp</div><div> >> added useDynLib directive to NAMESPACE</div>
<div> >> added Makevars file with Rcpp settings</div><div> >> added Makevars.win file with Rcpp settings</div><div> >> added example header file using Rcpp classes</div><div> >> added example src file using Rcpp classes</div>
<div> >> added example R file calling the C++ example</div><div> >> added Rd file for rcpp_hello_world</div><div> >> copied the example module </div><div><br></div><div>build</div><div>$ R CMD build test</div>
<div><<output omitted>></div><div><br></div><div>and check with an error.</div><div>$R CMD check test_1.0.tar.gz</div><div><div><<output omitted>></div></div><div><div>* checking whether the name space can be loaded with stated dependencies ... WARNING</div>
<div>Error: .onLoad failed in loadNamespace() for 'test', details:</div><div> call: value[[3L]](cond)</div><div> error: failed to load module yada from package test</div><div>Execution halted</div></div><div><br>
</div><div><<output omitted>></div><div><br></div><div>According to Dirk's June 15th post on the issue I include <span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px">require("methods", character=TRUE, quietly=TRUE) in the .onLoad function, now checks ok but when trying things out I get a segmentation fault.</span></div>
<div><span style="border-collapse:collapse;font-family:arial, sans-serif;font-size:13px">$ R -q --vanilla</span></div><div><font face="arial, sans-serif"><div><span style="border-collapse:collapse">R> library(test)</span></div>
<div><span style="border-collapse:collapse">Loading required package: Rcpp</span></div><div><span style="border-collapse:collapse">R> Module('yada','test')$bla()</span></div>
<div><span style="border-collapse:collapse"><br></span></div><div><span style="border-collapse:collapse"> *** caught segfault ***</span></div><div><span style="border-collapse:collapse">address 0x90, cause 'memory not mapped'</span></div>
<div><span style="border-collapse:collapse"><br></span></div><div><span style="border-collapse:collapse">Traceback:</span></div><div><span style="border-collapse:collapse"> 1: .Call(symbol)</span></div>
<div><span style="border-collapse:collapse"> 2: Module(module, mustStart = TRUE)</span></div><div><span style="border-collapse:collapse"> 3: .getModulePointer(x)</span></div>
<div><span style="border-collapse:collapse"> 4: Module("yada", "test")$bla</span></div><div><span style="border-collapse:collapse"><br></span></div>
<div><span style="border-collapse:collapse">Possible actions:</span></div><div><span style="border-collapse:collapse">1: abort (with core dump, if enabled)</span></div>
<div><span style="border-collapse:collapse">2: normal R exit</span></div><div><span style="border-collapse:collapse">3: exit R without saving workspace</span></div><div>
<span style="border-collapse:collapse">4: exit R saving workspace</span></div><div><span style="border-collapse:collapse">Selection: </span></div><div style="border-collapse:collapse">
<br></div></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">So questions are:</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse"> 1) is anyone else getting this error?</span></font></div>
<div><font face="arial, sans-serif"><span style="border-collapse:collapse"> 2) does anyone know how to fix it?</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br>
</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">Thanks,</span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">Andrew</span></font></div>
<font color="#888888">
<div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div>
</font><br></div></div><div class="im">_______________________________________________<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>
<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>
<br></div></blockquote></div><br>
</blockquote></div><br></div>