Can we use "ImportC" used yet?
data pulverizer
data.pulverizer at gmail.com
Sun Oct 24 05:54:43 UTC 2021
On Saturday, 23 October 2021 at 17:42:32 UTC, data pulverizer
wrote:
> On Saturday, 23 October 2021 at 16:39:08 UTC, data pulverizer
> wrote:
>> ```
>> ...
>> this(R_xlen_t n)
>> {
>> SEXPTYPE _real_ = SEXPTYPE.REALSXP;
>> _data = protect(allocVector(_real_, n));
>> unprotect(1);
>> }
>> ...
>> ```
>
> Looking at that code, I realise didn't need the un/protect.
Actually it's more complicated than that. On construction I do
need to call `protect` and call `unprotect` or `unprotect_ptr`
when the function in which the object is created returns. At the
moment, I'm not even sure (or more likely do not think) that it
is suitable to call it as part of the destructor. Anyway, that's
an aside.
More information about the Digitalmars-d-learn
mailing list