Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java Generics broken beyond repair?



The code might be simple in this case, but it's still a PITA to package and distribute platform-dependent binary files.

Aeon

On Dec 13, 2006, at 2:49 PM, Paul J. Lucas wrote:

On Dec 13, 2006, at 11:18 AM, Aeon B. C. Lee wrote:

JNI is a PITA for cross-platform ...

#if defined( __APPLE__ )
vm_address_t addr;
kern_return_t const result =
::vm_allocate( mach_task_self(), &addr, jSize, VM_FLAGS_ANYWHERE );
return result == KERN_SUCCESS ? static_cast<jlong>( addr ) : 0;
#elif defined( __WINDOWS__ )
return reinterpret_cast<jlong>(
::VirtualAlloc( NULL, jSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE )
);
#else
return reinterpret_cast<jlong>( new char[ jSize ] );
#endif


That pretty much covers everything. (If you wanted to do a special case for Solaris, it would be trivial.)

Seriously, JNI isn't a PITA for cross-platform, especially when just using arrays. The JNI API itself is the same across all platforms. To me, manually hacking Java byte codes sounds like much more of a PITA.

- Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Java Generics broken beyond repair? (From: "Aeon B. C. Lee" <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: Jerry <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: "Aeon B. C. Lee" <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: "Aeon B. C. Lee" <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: DrAnonymous <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: "Aeon B. C. Lee" <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: "Paul J. Lucas" <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: "Aeon B. C. Lee" <email@hidden>)
 >Re: Java Generics broken beyond repair? (From: "Paul J. Lucas" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.