Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT Cocoa for 64bit ?

Unfortunately there's no way to tell which architecture it's complaining
about. I will take a wild guess, though, and say it's x86_64.

The SWT stores pointers to native objects in ints, which are 32-bit values.
A simple cast to a pointer will give you this message. Look for the places
that turn an jint parameter into a pointer -- that jint will need to be a
jlong, and then work backwards from there.

The conversion from jlong to a pointer is somewhat tricky, but if you
install Java 6 on the Mac you'll get JavaNativeFoundation.framework which
has a file called JNFJNI.h which provides two macros ptr_to_jlong and
jlong_to_ptr:

// from jlong.h
// All pointers in and out of JNI functions should be expressed as jlongs
// to accomodate for both 32-bit and 64-bit pointer sizes
#define jlong_to_ptr(a) ((void *)(uintptr_t)(a))
#define ptr_to_jlong(a) ((jlong)(uintptr_t)(a))

Those macros are simple enough that they could be copied to some standard
header.

I think an early task in the Cocoa SWT needs to be making sure we store and
pass all pointers as long/jlong values. That way you don't have to think
about the differences between i386 and x86_64.

Scott

On 7/2/08 7:28 AM, "String Larson" <string01@xxxxxxxxx> wrote:

> I tried this, and get:
> 
> cc -c -xobjective-c -Wall -arch x86_64 -arch i386 -arch ppc -
> DSWT_VERSION=3448   -DUSE_ASSEMBLER -DCOCOA -I /System/Library/
> Frameworks/JavaVM.framework/Headers -I /System/Library/Frameworks/
> Cocoa.framework/Headers c.c
> <built-in>:0: warning: Mac OS X version 10.5 or later is needed for
> use of the new objc abi
> c.c: In function ŒJava_org_eclipse_swt_internal_C_free¹:
> c.c:35: warning: cast to pointer from integer of different size
> ...
> 
> 
> 
> On Jul 1, 2008, at 3:47 PM, Alex Blewitt wrote:
> 
>> If you build with -arch x86 -arch x86_64, you should get an intel fat
>> binary that can run in either 64 or 32-bit mode. However, I don't know
>> if all the libraries that SWT depends on are 64 bit yet, so there may
>> be compile/link errors. Better still, stick -arch ppc and -arch ppc64
>> on there, and you'll build for everything :-)
>> 
>> You can use lipo -info libswt-... to find out what it contains now:
>> 
>> apple[tmp] lipo -info libswt-carbon-3436.jnilib
>> Architectures in the fat file: libswt-carbon-3436.jnilib are: i386 ppc
>> 
>> (this is from an old build of Eclipse)
>> 
>> Alex
>> 
>> On Tue, Jul 1, 2008 at 5:55 PM, String Larson <string01@xxxxxxxxx>
>> wrote:
>>> 
>>> I was going to try to run Andy's NatTable release on OSX.
>>> I see the libswt-* files are still 32 bit universal binaries.
>>> 
>>> Has anyone converted those to 64bit ?
>>> 
>>> I was looking at the FAQ for converting GTK Linux 32 to 64 for
>>> hints but
>>> could not find parallels for Cocoa.
>>> 
>>> Thanks.
>>> -str
>>> 
>>> _______________________________________________
>>> platform-swt-dev mailing list
>>> platform-swt-dev@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>>> 
>> _______________________________________________
>> platform-swt-dev mailing list
>> platform-swt-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> 
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top