I figured I'd reply to my own questions:

1) When compiling resources, just sticking with windres 32 bit hacked to
call tcc seems to generate working resources, that will link into both 32
and 64-bit code.

2) I traced my issues with not being able to call certain comdlg32
functions, to issues with structure packing. Commenting out the #pragma
pack(push,1) in commdlg.h fixed it, and now I have working code in 32-bit
and 64-bit. 32-bit seems to like 1-byte alignment, and 64-bit presumably
defaults to 8-byte alignment.

Thanks so much everyone that's worked on this!

Best Wishes,
Jonathan







Hi,

I've been able to successfully use windres to compile, then tcc 0.9.26 to
link resources into a 32-bit program.

However, I'm kinda stuck trying to get tcc to link to a 64-bit windres
generated resource file.

1) Check for magic not yet supporting x86-64

In file tccpe.c, the pe_load_res is looking for 32-bit magic
//    if (hdr.filehdr.Machine != 0x014C
    if (hdr.filehdr.Machine != 0x8664
        || hdr.filehdr.NumberOfSections != 1
        || strcmp(hdr.sectionhdr.Name, ".rsrc") != 0) {
        printf("Machine: %lx", hdr.filehdr.Machine);
        goto quit;
    }

2) Resource files appear to be slightly different between win32 and x86-64

The reltype shows up as 3 in my compiled 64-bit resource but tcc is
expecting 7.

lower in same function...

        printf("rsrc_reloc: %x %x %x\n", rel.offset, rel.size, rel.type);
// debugging
        if (rel.type != 7) /* DIR32NB */ {
            printf("ERROR: rel.type != 7 Got: %d\n",rel.type);      //
prints a 3 for 64-bit resources
            goto quit;
        }

Has anyone pushed a bit further and managed to get tcc linking to 64-bit
resources?

Best Wishes,
Jonathan
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to