Can we use "ImportC" used yet?

data pulverizer data.pulverizer at
Fri Oct 22 06:11:35 UTC 2021

On Thursday, 21 October 2021 at 23:06:18 UTC, jfondren wrote:
> On Thursday, 21 October 2021 at 22:23:50 UTC, data pulverizer 
> wrote:
> I'd first check that the type names look OK in the processed C. 
> If they do, then it's an importc bug. Those are still getting 
> reported, but yours might be new. Worth checking out.

I've double-checked and the types names are fine in translated C 

> It might also be a bug that's been fixed since release--try dmd 
> master on it.

I have the latest compiler installed and I just double-checked by 
compiling dmd-master with the same result. The specific error is:

Error: function `Rf_allocVector(__tag28, long)` is not callable 
using argument types `(int, long)`
         cannot pass argument `REALSXP` of type `int` to parameter 

Here `__tag28` should be `SEXPTYPE` which is an `enum int` 
containing `REALSXP`.

Another (superficial by maybe related) issue is that `REALSXP` is 
an `SEXPTYPE` which is an `enum int` under the hood but dmd skips 
the `SEXPTYPE` description altogether, even though SEXPTYPE is 
correctly converted in the imported C file.

>> Also, with some definitions in the C file, when I try to 
>> `#undef` something to get some conditional C definitions to be 
>> converted with `gcc -E -P ...`, nothing happens.
> d doesn't do any C preprocessing, so any problem here is with 
> gcc. Your `#undef`s may be coming before the C preprocessor's 
> own `#define`s and have no effect.

I thought I'd ask anyway, it looks like a question for the R 
community, where `#undef R_NO_REMAP` in the script has no effect. 
This is unrelated to the first issue.

As @Imperatorn said (and I was aware as I asked the question) 
this is a new feature that is currently being worked on, and we 
should expect and report stuff like this. It's a great feature 
and lots of people will use it heavily. Including myself.

More information about the Digitalmars-d-learn mailing list