[Issue 23926] ImportC: D can’t pass pointer to const struct to C function declared taking pointer to const struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 28 15:20:32 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=23926

Lance Bachmeier <lance at lancebachmeier.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lance at lancebachmeier.com

--- Comment #4 from Lance Bachmeier <lance at lancebachmeier.com> ---
Can this be resolved by having ImportC generate a D overload? If const struct
Foo* is rewritten to Foo*, it should. This is a solution for this particular
example:

struct Foo;
void foo(Foo* x) {}
// ImportC generates this function when encountering const struct Foo*
void foo(const(Foo)* x) {
        foo(cast(Foo*) x);
}
void bar(const Foo* x) {
    foo(x);
}

--


More information about the Digitalmars-d-bugs mailing list