Movatterモバイル変換


[0]ホーム

URL:


opaque pointers in Java Re: ANNOUNCE: JPE, the Java-Python Extension - first beta release

Frederic Giacomettifrederic.giacometti at arakne.com
Mon Apr 30 18:46:07 EDT 2001


Gerhard Häring wrote:> On Sun, 29 Apr 2001 19:45:40 -0400, Frederic Giacometti wrote:> >April 28, 2001> >> >I am pleased to announce the first beta release of JPE,> >the Java-Python Extension.> >> > [...]>> I am also very pleased to see this come along. This will be a very useful tool> :-) erm ... Python <-> Java makes a lot more sense than Python <-> Ada 95, but> I am digressing ...>> Hmm, the build process was a little frustrating for me, but in the end it built> (with a gazillion warnings). When I try to run the TestDND.py sample, I get theJava does not provide opaque pointer capability (something like Python's COjbect).The concept is dearly missing to Java (a basic type matching a void* memoryaddress, and whose value could be accessible only from the Java/JNI C programminginterface).So, all references (pointers) to Python objects have to be cast back and forth tojlong (Java long) to be carried around in the Java objects.Visual C++ keeps this silent, on some Unix compilers (Tru64), specific warnings canbe turned off, but I could not find the feature on gcc...To keep the gcc compiler noise low when developping, I'll convert all casts usingthe following definitions (2 macro/function pairs):#ifdef JPE_NOLONGCASTWARNING  static void* jlong2void( jlong ref) {return (void*)ref;}  static jlong void2jlong( void* ref) {return (jlong)ref;}# define Jlong2void( ref) jlong2void( ref)# define Void2jlong( ref) void2jlong( ref)#else# define Jlong2void( ref) ((void*)(ref))# define Void2jlong( ref) ((jlong)(ref))#endifThat way, the gadzillon warnings will be reduced to 2 warnings, at the expense ofan additional function call...FG


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp