ImportC now supports function-like macros
Dakota
dakota at gmail.com
Mon Mar 4 05:15:17 UTC 2024
On Monday, 4 March 2024 at 02:22:51 UTC, Walter Bright wrote:
>
> Hence my suggestion of:
>
> #define const
>
> when having difficulties with non-transitive const!
Thanks again for all the explain and tips.
from a C library user perspective:
1) the struct pointer is represents a resource handle
2) all resource is create and destroy by the library
3) to access the resource property, use api function
4) resource has attribute of const, and non-const type. and they
are create and pass in and out into function call chain (a lot
mix const and non-const)
5) From the perspective of a library user, a resource pointer is
an opaque type.
in your point of view, the const pointer must behavior
transitive, not what the c library expected. this make no sense
for an opaque type. (you dont have the struct definition some
time). You are try interacting with the c library the D ways,
not C ways.
So until we get headconst, let user made the choice or force
convert into const(type)* will be my choice.
right now I will try some libcang solution, importC not work for
me here.
More information about the Digitalmars-d
mailing list