<div dir="ltr">Hi Dirk,<div>Thanks for your attention on this. I was able to find a solution that works for us.</div><div>Matthew</div><div><br></div><div><a href="https://github.com/NOAA-FIMS/ModularTMBExample/blob/map/src/tmb_objective_function.cpp#L133">https://github.com/NOAA-FIMS/ModularTMBExample/blob/map/src/tmb_objective_function.cpp#L133</a><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023 at 4:36 PM Jeff Newmiller <<a href="mailto:jdnewmil@dcn.davis.ca.us">jdnewmil@dcn.davis.ca.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Well, feel free to ignore my post, but the gist was that anything you have access to in R can be passed by your R API code to your Rcpp code. Also, due to R's GC you should usually avoid caching references between calls to your Rcpp code anyway.<br>
<br>
On March 24, 2023 12:40:43 PM PDT, Matthew Supernaw - NOAA Federal <<a href="mailto:matthew.supernaw@noaa.gov" target="_blank">matthew.supernaw@noaa.gov</a>> wrote:<br>
>Hi Jeff,<br>
>I'm not sure I understand your comment. The code is part of a package.<br>
>We're just trying to sync the declared object name in the R environment to<br>
>the object in the Rcpp module programmatically from c++ for internal use. I<br>
>just wondered if there was a way to access the wrapped object in the<br>
>Rcpp:::PreserveStorage class and Dirk answered that question.<br>
>Thanks.<br>
>Matthew<br>
><br>
><br>
>On Fri, Mar 24, 2023 at 2:34 PM Jeff Newmiller <<a href="mailto:jdnewmil@dcn.davis.ca.us" target="_blank">jdnewmil@dcn.davis.ca.us</a>><br>
>wrote:<br>
><br>
>> Matthew... the normal context for sharing Rcpp code is within a package.<br>
>> It is a no-brainer to have an R API called by the user that calls whatever<br>
>> Rcpp code it needs to, which is why your objection seems inappropriate to<br>
>> me.<br>
>><br>
>> On March 24, 2023 10:43:34 AM PDT, Dirk Eddelbuettel <<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>><br>
>> wrote:<br>
>> ><br>
>> >On 24 March 2023 at 13:08, Matthew Supernaw - NOAA Federal wrote:<br>
>> >| I'm sure it's possible to do from the R side, however, the requirement<br>
>> is to<br>
>> >| hide this from the end user and set the reference objects name to the<br>
>> declared<br>
>> >| name from the R environment. If I view the environment in RStudio,<br>
>> there is<br>
>> >| much more information available. ls() only returns a list of objects by<br>
>> their<br>
>> >| declared name. I'm wondering how to get more details about elements in<br>
>> the<br>
>> >| environment.<br>
>> ><br>
>> >Thanks for additional color. That may be a very interesting and valuable<br>
>> >question _for the C API of R_ and youe guess of "maybe Rcpp has a helper"<br>
>> is<br>
>> >a good one. Sadly, I fear we may not have anything for you.<br>
>> ><br>
>> >Dirk<br>
>> ><br>
>> >--<br>
>> ><a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><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>
>> ><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
>> --<br>
>> Sent from my phone. Please excuse my brevity.<br>
>><br>
><br>
><br>
<br>
-- <br>
Sent from my phone. Please excuse my brevity.<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Matthew Supernaw<br><i><font color="#666666">Scientific Software Developer</font></i></div><div><span style="line-height:16px;font-family:arial,sans-serif"><em><font color="#666666">National Oceanic and Atmospheric Administration</font></em></span></div><div><i><font face="arial, sans-serif" color="#666666">Office Of Science and Technology</font></i></div><div><font color="#666666"><i><font face="arial, sans-serif">NOAA Fisheries | </font></i><span style="font-family:Arial;font-size:13.3333px;white-space:pre-wrap">U.S. Department of Commerce</span></font></div><div><font color="#666666">Phone 248 - 396 - 7797</font><br><br></div><br></div></div>