Message-ID: <D93F56B8-04ED-490F-BF36-79AC58755228@r-enthusiasts.com>
Date: 2011-08-02T09:28:31Z
From: Romain Francois
Subject: [Rcpp-devel] wrap returned pointer to class
In-Reply-To: <AC660DFE-5B92-48B2-9B73-8BB99E53A41D@frias.uni-freiburg.de>
Ah,
I need to think about this. Will give you an update if i manage to deal with it.
Romain
Le 2 ao?t 2011 ? 11:24, Sebastian Weber <sebastian.weber at frias.uni-freiburg.de> a ?crit :
> Hi!
>
> The solution you point out there is exactly what I need - but without class intrusion. The class I am wrapping is not under my control, but belongs to a third party. Or does your solution apply also in a non-intrusive case which I overlooked?
>
> Cheers,
>
> Sebastian
>
> Am 02.08.2011 um 11:10 schrieb romain at r-enthusiasts.com:
>
>> Hello sebastian,
>>
>> I think what you are looking for is covered by some enhancements i added recently and described in this thread:
>>
>> http://thread.gmane.org/gmane.comp.lang.r.rcpp/2092
>>
>> Romain
>>
>>
>> Le 1 ao?t 2011 ? 18:07, Sebastian Weber <sebastian.weber at frias.uni-freiburg.de> a ?crit :
>>
>>> Hi,
>>>
>>> first of all thank you, Dirk and Romain, so much for this great library! I was stunned when I saw the examples.
>>>
>>> Hence, I started immediately a quite involved project which interfaces another library to R via C++. Currently I have the problem that I want to expose a function from a class which returns a pointer to a class. When exposing via the
>>>
>>> class_<A>.method("fun", &A::fun);
>>>
>>> mechanism, the compiler fails with a message saying that he cannot wrap the return type of function fun. The returned object itself is a pointer to another class B. How to solve this? I tried providing the wrap call with no success.
>>>
>>> Here is some code which might not work, but explains more detailed:
>>>
>>> class B {};
>>>
>>> class A {
>>> public:
>>> B* fun();
>>> };
>>>
>>> which gives, when compiled:
>>>
>>> /Library/Frameworks/R.framework/Versions/2.13/Resources/library/Rcpp/include/Rcpp/internal/wrap.h:428: error: cannot convert ?B* const? to ?SEXPREC*? in initialization
>>>
>>> Any ideas how to fix this?
>>>
>>> Thanks,
>>>
>>> PS: Is there some bug tracking tool? I got some weird problem when the function wrapped expects a char as input. I fixed it somehow, but I am not sure if it is the right way...
>>>
>>> --
>>> Sebastian Weber
>>> Group of Cell Communication and Control
>>> Freiburg Institute for Advanced Studies - FRIAS
>>> School of Life Sciences - LIFENET
>>> Albert-Ludwigs-Universit?t Freiburg
>>> Albertstr. 19
>>> 79104 Freiburg
>>> T.: +49-761-203-97237
>>> Fax:+49-761-203-97334
>>>
>>> _______________________________________________
>>> Rcpp-devel mailing list
>>> Rcpp-devel at lists.r-forge.r-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
> --
> Sebastian Weber
> Group of Cell Communication and Control
> Freiburg Institute for Advanced Studies - FRIAS
> School of Life Sciences - LIFENET
> Albert-Ludwigs-Universit?t Freiburg
> Albertstr. 19
> 79104 Freiburg
> T.: +49-761-203-97237
> Fax:+49-761-203-97334
>