diff --git a/testing/tools/screenshot/Makefile.in b/testing/tools/screenshot/Makefile.in index cacb56f4aed9..4113ae0439f2 100644 --- a/testing/tools/screenshot/Makefile.in +++ b/testing/tools/screenshot/Makefile.in @@ -57,9 +57,14 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),windows) PROGRAM = screenshot$(BIN_SUFFIX) CPPSRCS = win32-screenshot.cpp +OS_LIBS += $(call EXPAND_LIBNAME,gdiplus) MOZ_GLUE_PROGRAM_LDFLAGS = USE_STATIC_LIBS = 1 +ifdef GNU_CC +WIN32_EXE_LDFLAGS = -municode +endif + endif # windows include $(topsrcdir)/config/rules.mk diff --git a/testing/tools/screenshot/win32-screenshot.cpp b/testing/tools/screenshot/win32-screenshot.cpp index 691768242f56..dfb82340812b 100644 --- a/testing/tools/screenshot/win32-screenshot.cpp +++ b/testing/tools/screenshot/win32-screenshot.cpp @@ -32,24 +32,16 @@ * If a filename is specified as the first argument on the commandline, * then the image will be saved to that filename. Otherwise, the image will * be saved as "screenshot.png" in the current working directory. - * - * Requires GDI+. All linker dependencies are specified explicitly in this - * file, so you can compile screenshot.exe by simply running: - * cl screenshot.cpp */ #undef WIN32_LEAN_AND_MEAN #include #include -#pragma comment(lib, "user32.lib") -#pragma comment(lib, "gdi32.lib") -#pragma comment(lib, "gdiplus.lib") - using namespace Gdiplus; // From http://msdn.microsoft.com/en-us/library/ms533843%28VS.85%29.aspx -int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) +static int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) { UINT num = 0; // number of image encoders UINT size = 0; // size of the image encoder array in bytes @@ -80,6 +72,9 @@ int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) return -1; // Failure } +#ifdef __MINGW32__ +extern "C" +#endif int wmain(int argc, wchar_t** argv) { GdiplusStartupInput gdiplusStartupInput;