rakurakudonativecall

Using void structs in Raku via NativeCall


I'm trying to link libzip to Raku, and it uses a void struct or a struct with no body, like this:

struct zip;
typedef struct zip zip_t;

I declare it in my Raku program in the same way:

class zip_t is repr('CStruct'){};

This fails with:

Class zip_t has no attributes, which is illegal with the CStruct representation.

Only reference I have found to that error is in this non-addressed issue in MyHTML. That might make it a regression, but I'm really not sure. Any idea?


Solution

  • A google for "no attributes, which is illegal with the CStruct representation" yields three matches. The third leads to the following recent bug/change for module LibZip:

    - class zip is repr('CStruct') is export { }
    + class zip is repr('CPointer') is export { }
    

    Before I publish this I see Curt Tilmes has commented to similar effect.


    I know little about C. But I enjoy researching things. This answer is a guess and some notes based on googling.