diff --git a/src/c2v.v b/src/c2v.v index da4c21f..c87dfc7 100644 --- a/src/c2v.v +++ b/src/c2v.v @@ -824,6 +824,13 @@ fn (mut c C2V) typedef_decl(node &Node) { if node.name in builtin_type_names { return } + + if typ.starts_with('struct ') && typ.ends_with(' *') { + // Opaque pointer, for example: typedef struct TSTexture_t *TSTexture; + c.genln('type ${alias_name} = voidptr') + return + } + if !typ.contains(alias_name) { if typ.contains('(*)') { tt := convert_type(typ) diff --git a/tests/17.partial_struct.c b/tests/17.partial_struct.c new file mode 100644 index 0000000..5de3d24 --- /dev/null +++ b/tests/17.partial_struct.c @@ -0,0 +1 @@ +typedef struct TSTexture_t *TSTexture; diff --git a/tests/17.partial_struct.out b/tests/17.partial_struct.out new file mode 100644 index 0000000..cee21d8 --- /dev/null +++ b/tests/17.partial_struct.out @@ -0,0 +1,4 @@ +[translated] +module main + +type TSTexture = voidptr