From e6b74a8aafe487a8bc6cc1aa834ae52996145498 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 24 Dec 2020 16:30:33 +0000 Subject: [PATCH 1/2] gen: add MapHashFn typedef before map struct is declared map can't have a field of type function pointer because function pointer types are typedef'd after the map struct is declared. --- vlib/v/gen/cheaders.v | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vlib/v/gen/cheaders.v b/vlib/v/gen/cheaders.v index aff32839dbbd14..8df3977a5e07e0 100644 --- a/vlib/v/gen/cheaders.v +++ b/vlib/v/gen/cheaders.v @@ -428,6 +428,8 @@ static voidptr memfreedup(voidptr ptr, voidptr src, int sz) { free(ptr); return memdup(src, sz); } + +typedef uint64_t (*MapHashFn)(void*); ' c_builtin_types = ' //================================== builtin types ================================*/ From 40f64c80257cb9785448ad21bfb6d7e0582ab59f Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 24 Dec 2020 17:00:21 +0000 Subject: [PATCH 2/2] Add MapEqFn too --- vlib/v/gen/cheaders.v | 1 + 1 file changed, 1 insertion(+) diff --git a/vlib/v/gen/cheaders.v b/vlib/v/gen/cheaders.v index 8df3977a5e07e0..9463b007f50183 100644 --- a/vlib/v/gen/cheaders.v +++ b/vlib/v/gen/cheaders.v @@ -430,6 +430,7 @@ static voidptr memfreedup(voidptr ptr, voidptr src, int sz) { } typedef uint64_t (*MapHashFn)(void*); +typedef int (*MapEqFn)(void*, void*); ' c_builtin_types = ' //================================== builtin types ================================*/