Skip to content

Commit

Permalink
Fix conflict between FARPROC definition and minwindef.h
Browse files Browse the repository at this point in the history
minwindef.h defines FARPROC without (void) argument list, so if it is
already included when volk.c is compiled via VOLK_IMPLEMENTATION, gcc
will emit an error (MSVC handles this mismatch fine).

Unfortunately, simply removing (void) results in a warning with
Wstrict-prototypes even when volk.c is compiled as standalone. We could
disable the warning with a pragma but for now we could simply reuse
FARPROC definition from minwindef.h if it's already included.
  • Loading branch information
zeux committed Sep 11, 2023
1 parent 623a550 commit 8b7f11b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion volk.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
typedef const char* LPCSTR;
typedef struct HINSTANCE__* HINSTANCE;
typedef HINSTANCE HMODULE;
#ifdef _WIN64
#if defined(_MINWINDEF_)
/* minwindef.h defines FARPROC, and attempting to redefine it may conflict with -Wstrict-prototypes */
#elif defined(_WIN64)
typedef __int64 (__stdcall* FARPROC)(void);
#else
typedef int (__stdcall* FARPROC)(void);
Expand Down

1 comment on commit 8b7f11b

@ENDESGA
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for fixing this! I was adding so much mess around to fix this error, but I'm so glad it was just a simple change for Volk.

Please sign in to comment.