| ... | ... | @@ -10252,9 +10252,11 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, ZigType *type_e |
| 10252 | 10252 | gen_h->types_to_declare.append(type_entry); |
| 10253 | 10253 | return; |
| 10254 | 10254 | case ZigTypeIdStruct: |
| 10255 | | for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) { |
| 10256 | | TypeStructField *field = type_entry->data.structure.fields[i]; |
| 10257 | | prepend_c_type_to_decl_list(g, gen_h, field->type_entry); |
| 10255 | if(type_entry->data.structure.layout == ContainerLayoutExtern) { |
| 10256 | for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) { |
| 10257 | TypeStructField *field = type_entry->data.structure.fields[i]; |
| 10258 | prepend_c_type_to_decl_list(g, gen_h, field->type_entry); |
| 10259 | } |
| 10258 | 10260 | } |
| 10259 | 10261 | gen_h->types_to_declare.append(type_entry); |
| 10260 | 10262 | return; |
| ... | ... | @@ -10687,21 +10689,19 @@ static void gen_h_file(CodeGen *g) { |
| 10687 | 10689 | fprintf(out_h, "\n"); |
| 10688 | 10690 | } |
| 10689 | 10691 | |
| 10690 | | fprintf(out_h, "%s", buf_ptr(&types_buf)); |
| 10691 | | |
| 10692 | 10692 | fprintf(out_h, "#ifdef __cplusplus\n"); |
| 10693 | 10693 | fprintf(out_h, "extern \"C\" {\n"); |
| 10694 | 10694 | fprintf(out_h, "#endif\n"); |
| 10695 | 10695 | fprintf(out_h, "\n"); |
| 10696 | 10696 | |
| 10697 | fprintf(out_h, "%s", buf_ptr(&types_buf)); |
| 10697 | 10698 | fprintf(out_h, "%s\n", buf_ptr(&fns_buf)); |
| 10699 | fprintf(out_h, "%s\n", buf_ptr(&vars_buf)); |
| 10698 | 10700 | |
| 10699 | 10701 | fprintf(out_h, "#ifdef __cplusplus\n"); |
| 10700 | 10702 | fprintf(out_h, "} // extern \"C\"\n"); |
| 10701 | 10703 | fprintf(out_h, "#endif\n\n"); |
| 10702 | 10704 | |
| 10703 | | fprintf(out_h, "%s\n", buf_ptr(&vars_buf)); |
| 10704 | | |
| 10705 | 10705 | fprintf(out_h, "#endif // %s\n", buf_ptr(ifdef_dance_name)); |
| 10706 | 10706 | |
| 10707 | 10707 | if (fclose(out_h)) |