My feeling is, that one problem is, that harfbuzz uses some freetype2 data types, and freetype2 seems to declare some basic type symbols as pointers or handles, like
That is really ugly. I think I have to patch the function g-type-info-is-pointer() to return TRUE for these freetype data types.
[EDIT]
OK, I have applied this patch for now:
$ diff ~/gintrotest/test/gen.nim gen.nim
3c3
< # v 0.9.9 2022-JUL-10
---
> # v 0.9.9 2022-MAY-17
917,925c917
< var p = gTypeInfoIsPointer(t)
<
< if not p:
< let tag = gTypeInfoGetTag(t)
< if tag == GITypeTag.INTERFACE:
< let iface = gTypeInfoGetInterface(t)
< if gBaseInfoGetNamespace(iface) == "freetype2" and gBaseInfoGetName(iface) == "Face":
< p = true # see issue https://discourse.gnome.org/t/the-gintro-nim-bindings-do-not-compile-with-latest-harfbuzz-4-4-1/10408
<
---
> let p = gTypeInfoIsPointer(t)
For me it is actually more a freetype2 issue, due to
typedef struct FT_FaceRec_* FT_Face;
It is ugly, and only real solution which I can see is to modify the freetype2 library in a way that typedef structs are value objects and not pointers, but that may break other stuff.
Remember that freetype2’s GIR is hand-written, because freetype is not a GObject-based library, and as such there are no expectations its API conforms to the practices used by GObject-based libraries.
Theoretically, record elements for C types that are really aliases to pointers should use disguised="1" to indicate that they are really a pointer in disguise. The main issue is that, over the years, we started using disguised="1" also for opaque types.