input line is too long

Ranjit Mathew rmathew@hotmail.com
Fri Jan 3 16:05:00 GMT 2003


Erik Poupaert wrote:
> Probably, all the swt native sources will compile with gcc, when they add
> support for all these 'CHEVRONREBAR' things.

This is getting interesting - I tried my hand at it and have
some positive results to show you - I was able to compile the
SWT native sources from SWT 2.0.52 (Eclipse 2.0.2) using
MinGW itself!

Follow the steps below and you'll have better results:

1. Get the latest "mingw-runtime" (2.3) and "w32api" (2.1)
    packages from http://sourceforge.net/projects/mingw/
    ("oleacc.h" is included only from w32api-2.1 onwards).
    Install these packages into your MinGW installation
    folder.

2. Even after these updates the w32api package from MinGW
    is unfortunately not complete and you'll need to make
    the attached changes to SWT's "structs.h" as well as
    MinGW's "commctrl.h" to overcome these deficiencies.

3. Now compile the SWT C sources into object files:

    gcc -c -DSWT_VERSION=2052 -DSWT_BUILD_NUM=666 -D_X86_=1 -D_WIN32 \
    -D_WIN95 -D_WIN32_WINDOWS=0x0400 -D_MT -DWIN32 -D_WIN32_DCOM \
    swt.c swtole.c callback.c structs.c

4. Modify SWT's resource file a bit as given below and
    compile it into an object file using MinGW's "windres" tool:
-------------------------------- 8< --------------------------------
--- swt.rc      Fri Jan  3 21:00:33 2003
+++ swt.rc      Fri Jan  3 21:08:34 2003
@@ -11 +11 @@
- FILEVERSION SWT_COMMA_VERSION
+ FILEVERSION 2,0,0,52
@@ -29 +29 @@
-            VALUE "FileVersion", SWT_FILE_VERSION
+            VALUE "FileVersion", "2.052\0"
@@ -32 +32 @@
-            VALUE "OriginalFilename", SWT_ORG_FILENAME
+            VALUE "OriginalFilename", "swt-win32-2052.dll\0"
@@ -59 +59 @@
-    0, 0, 0,
+    0, 0, 0
-------------------------------- 8< --------------------------------

    windres swt.rc -o swtres.o

5. Now generate the exports file from the object files:

    dlltool --output-def foo.def \
        callback.o  structs.o  swt.o  swtole.o  swtres.o

    dlltool --dllname swt-win32-2052.dll --output-exp foobar.exp \
        --def foo.def

6. You can now link in the SWT object files as well as the
    exports file generated above into your application!

SWT "structs.h" patch:
-------------------------------- 8< --------------------------------
--- structs.h	Fri Jan  3 20:12:34 2003
+++ structs.h	Fri Jan  3 20:32:24 2003
@@ -43,4 +43,68 @@
  #endif // WIN32_PLATFORM_PSPC

+#ifdef __MINGW32__
+
+typedef struct _GRADIENT_RECT
+{
+    ULONG UpperLeft;
+    ULONG LowerRight;
+} GRADIENT_RECT, *PGRADIENT_RECT;
+
+typedef struct _NMREBARCHEVRON
+{
+    NMHDR hdr;
+    UINT uBand;
+    UINT wID;
+    LPARAM lParam;
+    RECT rc;
+    LPARAM lParamNM;
+} NMREBARCHEVRON, *LPNMREBARCHEVRON;
+
+typedef struct _NMTOOLBAR
+{
+    NMHDR hdr;
+    int iItem;
+    TBBUTTON tbButton;
+    int cchText;
+    LPTSTR pszText;
+    RECT rcButton;
+} NMTOOLBAR, *LPNMTOOLBAR;
+
+typedef struct _NMTTDISPINFOA
+{
+    NMHDR hdr;
+    LPSTR lpszText;
+    char szText[80];
+    HINSTANCE hinst;
+    UINT uFlags;
+    LPARAM lParam;
+} NMTTDISPINFOA, *LPNMTTDISPINFOA;
+
+typedef struct _NMTTDISPINFOW
+{
+    NMHDR hdr;
+    LPWSTR lpszText;
+    WCHAR szText[80];
+    HINSTANCE hinst;
+    UINT uFlags;
+    LPARAM lParam;
+} NMTTDISPINFOW, *LPNMTTDISPINFOW;
+
+typedef struct _OLECMD
+{
+    ULONG cmdID;
+    DWORD cmdf;
+} OLECMD;
+
+typedef struct _OLECMDTEXT
+{
+    DWORD cmdtextf;
+    ULONG cwActual;
+    ULONG cwBuf;
+    wchar_t rgwz[1];
+} OLECMDTEXT;
+
+#endif /* __MINGW32__ */
+
  /** Structs */

@@ -616,5 +680,5 @@
  void setPRINTDLGFields(JNIEnv *env, jobject lpObject, PRINTDLG *lpStruct, PPRINTDLG_FID_CACHE 
lpCache);

-#endif _WIN32_WCE
+#endif /* _WIN32_WCE */

  /* REBARBANDINFO struct */
-------------------------------- 8< --------------------------------

MinGW w32api-2.1 "commctrl.h" patch:
-------------------------------- 8< --------------------------------
--- commctrl.h	Fri Jan  3 20:42:58 2003
+++ commctrl.h	Fri Jan  3 20:44:40 2003
@@ -1598,4 +1598,5 @@
  	HINSTANCE hinst;
  	LPSTR lpszText;
+	LPARAM lParam;
  } TOOLINFOA,*PTOOLINFOA,*LPTOOLINFOA;
  typedef struct tagTOOLINFOW {
@@ -1695,4 +1696,5 @@
  	UINT flags;
  	int iItem;
+	int iSubItem;
  } LVHITTESTINFO;
  #define _LV_HITTESTINFO _LVHITTESTINFO
-------------------------------- 8< --------------------------------

Hope this helps.

Sincerely Yours,
Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/





More information about the Java mailing list