Enables calling

  widl -t in.idl -o out.tlb

without further parameters in MSYS2 environments.

Signed-off-by: Helge Konetzka <[email protected]>

---

I'm experiencing issues compiling https://gitlab.com/qemu-project/qemu/-/blob/master/qga/vss-win32/qga-vss.idl in /mingw64 environment of MSYS2

Currently widl is packaged like

  configure --prefix=/mingw64 \
    --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 \
    && make && make install

which results in:

  gcc ... \
    -DINCLUDEDIR=\""/mingw64/x86_64-w64-mingw32/include"\" \
    -DBIN_TO_INCLUDEDIR=\""../x86_64-w64-mingw32/include"\" \
    -DBIN_TO_DLLDIR=\""../x86_64-w64-mingw32/include"\" \
    -DDLLDIR="\"/mingw64/lib\"" \
    ...

$ widl -t qga-vss.idl -o qga-vss.tlb
qga-vss.idl:1: error: Unable to open include file oaidl.idl


Next widl will be packaged like

  configure --prefix=/mingw64 \
    --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 \
    --with-widl-includedir="/mingw64/include" && \
    make && make install

which results in:

  gcc ... \
    -DINCLUDEDIR=\""/mingw64/include"\" \
    -DBIN_TO_INCLUDEDIR=\""../include"\" \
    -DBIN_TO_DLLDIR=\""../include"\" \
    -DDLLDIR="\"/mingw64/lib\"" \
    ...

$ widl -t qga-vss.idl -o qga-vss.tlb
error: cannot find stdole2.tlb


Now BIN_TO_INCLUDEDIR is set in a way widl.c can make use of it in line 742:
wpp_add_include_path(strmake("%s%s/%s", sysroot, exe_path, BIN_TO_INCLUDEDIR));

But there is no equivalent to line 742 in widl.c to make use of BIN_TO_DLLDIR, which this patch addresses.

After application of the patch

$ widl -t qga-vss.idl -o qga-vss.tlb

succeeds.

---
 mingw-w64-tools/widl/src/widl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
index 995e95792..2955dddc2 100644
--- a/mingw-w64-tools/widl/src/widl.c
+++ b/mingw-w64-tools/widl/src/widl.c
@@ -740,6 +740,7 @@ int main(int argc,char *argv[])
           strrchr (exe_path, '/')[1] = '\0';
       }
wpp_add_include_path(strmake("%s%s/%s", sysroot, exe_path, BIN_TO_INCLUDEDIR)); + strarray_add(&dlldirs, strmake("%s%s/%s", sysroot, exe_path, BIN_TO_DLLDIR));
   }

   if (pointer_size)
--
2.36.1


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to