diff mbox

[FFmpeg-devel] cmdutils: fix implicit declaration of SetDllDirectory function

Message ID 7e0b9739-a039-eb34-ce34-730563ed47e6@noa-archive.com
State Superseded
Headers show

Commit Message

Tobias Rapp Aug. 30, 2016, 7:31 a.m. UTC
On 30.08.2016 04:10, James Almer wrote:
> On 8/29/2016 10:42 AM, Tobias Rapp wrote:
>> Attached patch fixes a build error on my system (Ubuntu 14.04,
>> mingw-w64 3.1.0, gcc-mingw-w64 4.8.2) introduced by commit
>> 3bf142c77337814458ed8e036796934032d9837f.
>
> Interesting. windows.h is already included if CommandLineToArgvW() is
> available. I guess this means old mingw-w64 doesn't define it.

HAVE_COMMANDLINETOARGVW is set to "1" in config.h on my system, but the
include of windows.h for CommandLineToArgvW() is on line 228 while
SetDllDirectory() is used on line 118.

Attached patch is a suggestion to refactor the includes by moving the
include of shellapi.h to the top of the file.

>> As the original commit has been backported to older releases (2.8,
>> 3.0 and 3.1 as far as I can see) it probably makes sense to
>> backport this fix, too.
>
> Applied where it's needed. Thanks.

Regards,
Tobias
diff mbox

Patch

From 5d1cbec583647b5023589afba3f5095583d7ccd6 Mon Sep 17 00:00:00 2001
From: Tobias Rapp <t.rapp@noa-archive.com>
Date: Tue, 30 Aug 2016 09:19:04 +0200
Subject: [PATCH] cmdutils: move includes to top of file

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
---
 cmdutils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmdutils.c b/cmdutils.c
index 44f44cd..cc27c63 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -64,6 +64,9 @@ 
 #ifdef _WIN32
 #include <windows.h>
 #endif
+#if HAVE_COMMANDLINETOARGVW
+#include <shellapi.h>
+#endif
 
 static int init_report(const char *env);
 
@@ -225,8 +228,6 @@  static const OptionDef *find_option(const OptionDef *po, const char *name)
  * by default. HAVE_COMMANDLINETOARGVW is true on cygwin, while
  * it doesn't provide the actual command line via GetCommandLineW(). */
 #if HAVE_COMMANDLINETOARGVW && defined(_WIN32)
-#include <windows.h>
-#include <shellapi.h>
 /* Will be leaked on exit */
 static char** win32_argv_utf8 = NULL;
 static int win32_argc = 0;
-- 
1.9.1