Skip to content

CppSharp generates incorrect cast for const char** in struct #1930

Description

@perlun

Hi,

I am using CppSharp 1.1.5.3168 and it generally works fine, given its limitations, but... there's one annoying bug where it generates the wrong return type for the following construct:

namespace perlang::collections
{
    struct StringArray {
        const char** items;
        unsigned long size;
    };
}

This causes the following C# code to be generated:

public sbyte** Items
{
    get
    {
        return (string*) ((__Internal*)__Instance)->items;
    }
}

But this will, naturally, not fly. The return (string *) part there should be return (sbyte**). If I edit the generated code like this, it works perfectly, but it's a bit annoying to have to do this every time the interop code is regenerated. 🙂

If you can point me in the right direction in the codebase, I'm happy to attempt to provide a fix for this. Thanks for a nice tool. 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions