~centralelyon2010/inkscape/imagelinks2

1 by mental
moving trunk for module inkscape
1
#ifdef HAVE_CONFIG_H
2
# include "config.h"
3
#endif
4
5
#include <stdlib.h>
6
#include <glib.h>
7
8
#ifdef G_OS_WIN32
9
#undef DATADIR
9012.1.137 by Krzysztof Kosiński
Patch from Fridrich - LP #520532
10
9012.1.138 by Krzysztof Kosiński
Adjust Windows build after fixing LP #520532
11
#include <stdio.h>
9012.1.137 by Krzysztof Kosiński
Patch from Fridrich - LP #520532
12
#include <io.h>
13
#include <conio.h>
14
#define _WIN32_WINNT 0x0501
1 by mental
moving trunk for module inkscape
15
#include <windows.h>
16
17
extern int main (int argc, char **argv);
18
19
/* In case we build this as a windowed application */
20
21
#ifdef __GNUC__
22
#  ifndef _stdcall
23
#    define _stdcall  __attribute__((stdcall))
24
#  endif
25
#endif
26
27
int _stdcall
28
WinMain (struct HINSTANCE__ *hInstance,
29
	 struct HINSTANCE__ *hPrevInstance,
30
	 char               *lpszCmdLine,
31
	 int                 nCmdShow)
32
{
9012.1.137 by Krzysztof Kosiński
Patch from Fridrich - LP #520532
33
    if (fileno (stdout) != -1 &&
34
 	  _get_osfhandle (fileno (stdout)) != -1)
35
	{
36
	  /* stdout is fine, presumably redirected to a file or pipe */
37
	}
38
    else
39
    {
40
	  typedef BOOL (* WINAPI AttachConsole_t) (DWORD);
41
42
	  AttachConsole_t p_AttachConsole =
43
	    (AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole");
44
45
	  if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS))
46
      {
47
	      freopen ("CONOUT$", "w", stdout);
48
	      dup2 (fileno (stdout), 1);
49
	      freopen ("CONOUT$", "w", stderr);
50
	      dup2 (fileno (stderr), 2);
51
52
      }
53
	}
54
1 by mental
moving trunk for module inkscape
55
	int ret;
56
	ret = main (__argc, __argv);
57
	return ret;
58
}
59
60
#endif