fix OS X workaround
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java
index 05e0f88..e363f3d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/cocoa/org/eclipse/swt/browser/MozillaDelegate.java
@@ -52,7 +52,7 @@
 static void loadAdditionalLibraries (String mozillaPath) {
 	String utilsPath = mozillaPath + Mozilla.SEPARATOR_OS + "libmozutils.dylib"; //$NON-NLS-1$
 	byte[] bytes = MozillaDelegate.wcsToMbcs (null, utilsPath, true);
-	OS.dlopen (bytes, OS.RTLD_NOW | OS.RTLD_GLOBAL);
+	OS.NSAddImage (bytes, OS.NSADDIMAGE_OPTION_RETURN_ON_ERROR | OS.NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME);
 }
 
 static char[] mbcsToWcs (String codePage, byte [] buffer) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
index f8f9cf6..498421c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom.cpp
@@ -12,7 +12,7 @@
 #include "swt.h"
 #include "xpcom_structs.h"
 #include "xpcom_stats.h"
- 
+
 #define XPCOM_NATIVE(func) Java_org_eclipse_swt_internal_mozilla_XPCOM_##func
 
 #if (!defined(NO__1Call__I) && !defined(JNI64)) || (!defined(NO__1Call__J) && defined(JNI64))
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
index 4febc35..168cf30 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.cpp
@@ -11,7 +11,7 @@
 
 #include "swt.h"
 #include "xpcom_stats.h"
- 
+
 #ifdef NATIVE_STATS
 
 int XPCOM_nativeFunctionCount = 247;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
index 1a28c96..f62ba6c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/library/xpcom_stats.h
@@ -8,7 +8,7 @@
  * Contributors:
  *    IBM Corporation - initial API and implementation
  *******************************************************************************/
- 
+
 #ifdef NATIVE_STATS
 extern int XPCOM_nativeFunctionCount;
 extern int XPCOM_nativeFunctionCallCount[];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
index f3fc724..72559e6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.c
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -4383,6 +4383,22 @@
 }
 #endif
 
+#ifndef NO_NSAddImage
+JNIEXPORT jintLong JNICALL OS_NATIVE(NSAddImage)
+	(JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
+{
+	jbyte *lparg0=NULL;
+	jintLong rc = 0;
+	OS_NATIVE_ENTER(env, that, NSAddImage_FUNC);
+	if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+	rc = (jintLong)NSAddImage((const char*)lparg0, (uint32_t)arg1);
+fail:
+	if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+	OS_NATIVE_EXIT(env, that, NSAddImage_FUNC);
+	return rc;
+}
+#endif
+
 #ifndef NO_NSAffineTransformStruct_1sizeof
 JNIEXPORT jint JNICALL OS_NATIVE(NSAffineTransformStruct_1sizeof)
 	(JNIEnv *env, jclass that)
@@ -9359,7 +9375,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, struct objc_super *, jintLong, jintLong))objc_msgSendSuper_stret)(lparg0, lparg1, arg2, arg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, jintLong))objc_msgSendSuper_stret)(lparg1, arg2, arg3);
 	} else {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, jintLong))objc_msgSendSuper)(lparg1, arg2, arg3);
@@ -9393,7 +9411,9 @@
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
 	if (arg4) if ((lparg4 = getNSRectFields(env, arg4, &_arg4)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, struct objc_super *, jintLong, jintLong, NSRect, jintLong))objc_msgSendSuper_stret)(lparg0, lparg1, arg2, arg3, *lparg4, arg5);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, jintLong, NSRect, jintLong))objc_msgSendSuper_stret)(lparg1, arg2, arg3, *lparg4, arg5);
 	} else {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, jintLong, NSRect, jintLong))objc_msgSendSuper)(lparg1, arg2, arg3, *lparg4, arg5);
@@ -9428,7 +9448,9 @@
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, struct objc_super *, jintLong, NSRect))objc_msgSendSuper_stret)(lparg0, lparg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, NSRect))objc_msgSendSuper_stret)(lparg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, NSRect))objc_msgSendSuper)(lparg1, arg2, *lparg3);
@@ -9463,7 +9485,9 @@
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, struct objc_super *, jintLong, NSRect, jintLong))objc_msgSendSuper_stret)(lparg0, lparg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, NSRect, jintLong))objc_msgSendSuper_stret)(lparg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSRect (*)(struct objc_super *, jintLong, NSRect, jintLong))objc_msgSendSuper)(lparg1, arg2, *lparg3, arg4);
@@ -9496,7 +9520,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, struct objc_super *, jintLong))objc_msgSendSuper_stret)(lparg0, lparg1, arg2);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(struct objc_super *, jintLong))objc_msgSendSuper_stret)(lparg1, arg2);
 	} else {
 		*lparg0 = (*(NSSize (*)(struct objc_super *, jintLong))objc_msgSendSuper)(lparg1, arg2);
@@ -9530,7 +9556,9 @@
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, struct objc_super *, jintLong, NSRect))objc_msgSendSuper_stret)(lparg0, lparg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(struct objc_super *, jintLong, NSRect))objc_msgSendSuper_stret)(lparg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSSize (*)(struct objc_super *, jintLong, NSRect))objc_msgSendSuper)(lparg1, arg2, *lparg3);
@@ -9563,7 +9591,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg1) if ((lparg1 = getobjc_superFields(env, arg1, &_arg1)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, struct objc_super *, jintLong, jboolean))objc_msgSendSuper_stret)(lparg0, lparg1, arg2, arg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(struct objc_super *, jintLong, jboolean))objc_msgSendSuper_stret)(lparg1, arg2, arg3);
 	} else {
 		*lparg0 = (*(NSSize (*)(struct objc_super *, jintLong, jboolean))objc_msgSendSuper)(lparg1, arg2, arg3);
@@ -10000,7 +10030,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSAffineTransformStruct_2JJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSAffineTransformStructFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSAffineTransformStruct *, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSAffineTransformStruct (*)(jintLong, jintLong))objc_msgSend_stret)(arg1, arg2);
 	} else {
 		*lparg0 = (*(NSAffineTransformStruct (*)(jintLong, jintLong))objc_msgSend)(arg1, arg2);
@@ -10029,7 +10061,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSPoint_2JJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSPoint *, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong))objc_msgSend_stret)(arg1, arg2);
 	} else {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong))objc_msgSend)(arg1, arg2);
@@ -10058,7 +10092,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSPoint_2JJJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSPoint *, jintLong, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, arg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong, jintLong))objc_msgSend_stret)(arg1, arg2, arg3);
 	} else {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong, jintLong))objc_msgSend)(arg1, arg2, arg3);
@@ -10089,7 +10125,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSPointFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSPoint *, jintLong, jintLong, NSPoint))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong, NSPoint))objc_msgSend_stret)(arg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong, NSPoint))objc_msgSend)(arg1, arg2, *lparg3);
@@ -10121,7 +10159,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSPointFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSPointFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSPoint *, jintLong, jintLong, NSPoint, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong, NSPoint, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSPoint (*)(jintLong, jintLong, NSPoint, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4);
@@ -10151,7 +10191,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSRange_2JJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRange *, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong))objc_msgSend_stret)(arg1, arg2);
 	} else {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong))objc_msgSend)(arg1, arg2);
@@ -10180,7 +10222,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSRange_2JJJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRange *, jintLong, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, arg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong, jintLong))objc_msgSend_stret)(arg1, arg2, arg3);
 	} else {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong, jintLong))objc_msgSend)(arg1, arg2, arg3);
@@ -10211,7 +10255,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRangeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRange *, jintLong, jintLong, NSRange, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong, NSRange, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong, NSRange, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4);
@@ -10243,7 +10289,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRangeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRange *, jintLong, jintLong, NSRect))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong, NSRect))objc_msgSend_stret)(arg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSRange (*)(jintLong, jintLong, NSRect))objc_msgSend)(arg1, arg2, *lparg3);
@@ -10273,7 +10321,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSRect_2JJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong))objc_msgSend_stret)(arg1, arg2);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong))objc_msgSend)(arg1, arg2);
@@ -10302,7 +10352,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSRect_2JJJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, arg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong))objc_msgSend_stret)(arg1, arg2, arg3);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong))objc_msgSend)(arg1, arg2, arg3);
@@ -10331,7 +10383,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSRect_2JJJJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, arg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong, jintLong))objc_msgSend_stret)(arg1, arg2, arg3, arg4);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong, jintLong))objc_msgSend)(arg1, arg2, arg3, arg4);
@@ -10360,7 +10414,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSRect_2JJJJZ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, jintLong, jintLong, jboolean))objc_msgSend_stret)(lparg0, arg1, arg2, arg3, arg4, arg5);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong, jintLong, jboolean))objc_msgSend_stret)(arg1, arg2, arg3, arg4, arg5);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong, jintLong, jboolean))objc_msgSend)(arg1, arg2, arg3, arg4, arg5);
@@ -10391,7 +10447,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg4) if ((lparg4 = getNSRectFields(env, arg4, &_arg4)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, jintLong, NSRect, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, arg3, *lparg4, arg5);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong, NSRect, jintLong))objc_msgSend_stret)(arg1, arg2, arg3, *lparg4, arg5);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, jintLong, NSRect, jintLong))objc_msgSend)(arg1, arg2, arg3, *lparg4, arg5);
@@ -10423,7 +10481,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRangeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, NSRange, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSRange, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSRange, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4);
@@ -10455,7 +10515,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, NSRect))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSRect))objc_msgSend_stret)(arg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSRect))objc_msgSend)(arg1, arg2, *lparg3);
@@ -10487,7 +10549,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, NSRect, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSRect, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSRect, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4);
@@ -10519,7 +10583,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSRectFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSSizeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSRect *, jintLong, jintLong, NSSize, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSSize, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSRect (*)(jintLong, jintLong, NSSize, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4);
@@ -10549,7 +10615,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSSize_2JJ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong))objc_msgSend_stret)(arg1, arg2);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong))objc_msgSend)(arg1, arg2);
@@ -10580,7 +10648,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSRectFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong, NSRect))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSRect))objc_msgSend_stret)(arg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSRect))objc_msgSend)(arg1, arg2, *lparg3);
@@ -10612,7 +10682,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSSizeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong, NSSize))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize))objc_msgSend_stret)(arg1, arg2, *lparg3);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize))objc_msgSend)(arg1, arg2, *lparg3);
@@ -10644,7 +10716,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSSizeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong, NSSize, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4);
@@ -10676,7 +10750,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSSizeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong, NSSize, jintLong, jintLong, jintLong, jintLong, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4, arg5, arg6, arg7, arg8);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize, jintLong, jintLong, jintLong, jintLong, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4, arg5, arg6, arg7, arg8);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize, jintLong, jintLong, jintLong, jintLong, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4, arg5, arg6, arg7, arg8);
@@ -10708,7 +10784,9 @@
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
 	if (arg3) if ((lparg3 = getNSSizeFields(env, arg3, &_arg3)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong, NSSize, jboolean, jboolean, jintLong))objc_msgSend_stret)(lparg0, arg1, arg2, *lparg3, arg4, arg5, arg6);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize, jboolean, jboolean, jintLong))objc_msgSend_stret)(arg1, arg2, *lparg3, arg4, arg5, arg6);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, NSSize, jboolean, jboolean, jintLong))objc_msgSend)(arg1, arg2, *lparg3, arg4, arg5, arg6);
@@ -10738,7 +10816,9 @@
 	OS_NATIVE_ENTER(env, that, objc_1msgSend_1stret__Lorg_eclipse_swt_internal_cocoa_NSSize_2JJZ_FUNC);
 #endif
 	if (arg0) if ((lparg0 = getNSSizeFields(env, arg0, &_arg0)) == NULL) goto fail;
-	if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
+	if (STRUCT_SIZE_LIMIT == 0) {
+		((void (*)(NSSize *, jintLong, jintLong, jboolean))objc_msgSend_stret)(lparg0, arg1, arg2, arg3);
+	} else if (sizeof(_arg0) > STRUCT_SIZE_LIMIT) {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, jboolean))objc_msgSend_stret)(arg1, arg2, arg3);
 	} else {
 		*lparg0 = (*(NSSize (*)(jintLong, jintLong, jboolean))objc_msgSend)(arg1, arg2, arg3);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h
index 78f7a93..5155e3f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os.h
@@ -20,6 +20,7 @@
 #include <Carbon/Carbon.h>
 #include <WebKit/WebKit.h>
 #include <JavaScriptCore/JavaScriptCore.h>
+#include "/usr/include/mach-o/dyld.h"
 
 #include "os_custom.h"
 
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
index 95d9415..a8fae8b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.c
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@
 
 #ifdef NATIVE_STATS
 
-int OS_nativeFunctionCount = 630;
-int OS_nativeFunctionCallCount[630];
+int OS_nativeFunctionCount = 631;
+int OS_nativeFunctionCallCount[631];
 char * OS_nativeFunctionNames[] = {
 	"ATSFontActivateFromFileReference",
 	"AcquireRootMenu",
@@ -332,6 +332,7 @@
 	"NSAccessibilityVisibleRowsAttribute",
 	"NSAccessibilityWindowAttribute",
 	"NSAccessibilityWindowRole",
+	"NSAddImage",
 	"NSAffineTransformStruct_1sizeof",
 	"NSApplicationDidChangeScreenParametersNotification",
 	"NSAttachmentAttributeName",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
index 4a3efdb..fa14656 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/library/os_stats.h
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -340,6 +340,7 @@
 	NSAccessibilityVisibleRowsAttribute_FUNC,
 	NSAccessibilityWindowAttribute_FUNC,
 	NSAccessibilityWindowRole_FUNC,
+	NSAddImage_FUNC,
 	NSAffineTransformStruct_1sizeof_FUNC,
 	NSApplicationDidChangeScreenParametersNotification_FUNC,
 	NSAttachmentAttributeName_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index 39fc577..3446232 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -143,7 +143,7 @@
 	/** @method flags=const dynamic no_gen*/
 	public static final native int /*long*/ NSAccessibilityCellRole();
 	public static final NSString NSAccessibilityCellRole = new NSString(NSAccessibilityCellRole());
-	
+
 	/** 10.7 selectors and constants */
 	public static final int /*long*/ sel_isCompatibleWithOverlayScrollers = sel_registerName("isCompatibleWithOverlayScrollers");
 	public static final int /*long*/ sel_flashScrollers = sel_registerName("flashScrollers");
@@ -2227,6 +2227,8 @@
 public static final int /*long*/ sel_zoom_ = sel_registerName("zoom:");
 
 /** Constants */
+public static final int NSADDIMAGE_OPTION_RETURN_ON_ERROR = 0x1;
+public static final int NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME = 0x8;
 public static final int NSAlertFirstButtonReturn = 1000;
 public static final int NSAlertSecondButtonReturn = 1001;
 public static final int NSAlertThirdButtonReturn = 1002;
@@ -3141,6 +3143,11 @@
 public static final native int /*long*/ NSAccessibilityUnignoredDescendant(int /*long*/ element);
 public static final native void NSBeep();
 /**
+ * @param image_name cast=(const char*)
+ * @param options cast=(uint32_t)
+ */
+public static final native int /*long*/ NSAddImage(byte[] image_name, int options);
+/**
  * @param depth cast=(NSWindowDepth)
  */
 public static final native int /*long*/ NSBitsPerPixelFromDepth(int depth);