[PATCH v3 1/5] widl: Search for known types in current namespace.

Rémi Bernon rbernon at codeweavers.com
Thu Sep 3 07:41:59 CDT 2020


Fixes the following error with this sample idl:

    #ifdef __WIDL__
    #pragma winrt ns_prefix
    #endif

    import "wtypes.idl";

    namespace Windows {
        [object]
        interface IFoo {}

        [object]
        interface IBar { HRESULT DoBar([in] IFoo *foo); }
    }

$ widl -o windows.foo.h windows.foo.idl
windows.foo.idl:13: error: type 'IFoo' not found

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

v3: I included sample idl with each patch to better show the use case
    they cover. The whole series then will allow us to declare WinRT
    interfaces in the correct idl files, in order to stub several DLLs
    that are required for Death Stranding and Flight Simulator to start.

    The DLL stubbing would look like the following patches I intend to
    send next if this widl series is accepted:

  * https://gitlab.com/rbernon/wine/-/commit/478b77d3f8.patch

  * https://gitlab.com/rbernon/wine/-/commit/a2d705e0f5.patch

  * https://gitlab.com/rbernon/wine/-/commit/cca2304aa1.patch

  * https://gitlab.com/rbernon/wine/-/commit/03f0f3a9d1.patch

  * https://gitlab.com/rbernon/wine/-/commit/745b9f01e4.patch

 tools/widl/parser.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 3ef8d89ba1c..91c5b809bb3 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1959,7 +1959,7 @@ type_t *find_type(const char *name, struct namespace *namespace, int t)
 
 static type_t *find_type_or_error(const char *name, int t)
 {
-  type_t *type = find_type(name, NULL, t);
+  type_t *type = find_type(name, current_namespace, t);
   if (!type) {
     error_loc("type '%s' not found\n", name);
     return NULL;
-- 
2.28.0




More information about the wine-devel mailing list