## [Jython-users] Problem with jython

 [Jython-users] Problem with jython From: Duch - 2002-06-03 15:34:22 ```I use the following function to convert a 'long' python equivalent into an 'unsigned long long' C eqivalent. Without using jython, this function works. I don't know how i can do it, in another way, to apply jythonc interpreter on this function. import struct def pack (n) : # 0 <= n <= 2 ** 64 - 1 # Convert a 'long' in an 'unsigned long long' C equivalent # Representation on 8 octets p_low = n & (2L ** 31 - 1) p_high = (n & (2L ** 64 - 2L ** 32)) >> 32 return struct.pack ('LL', p_low, p_high) def unpack (s) : # Convert an 'unsigned long long' in a 'long' python equivalent p_low, p_high = struct.unpack ('LL', s) return (p_high << 32) + p_low Thanks a lot, Sebastien Dumont. ```

 [Jython-users] Problem with jython From: Duch - 2002-06-03 15:34:22 ```I use the following function to convert a 'long' python equivalent into an 'unsigned long long' C eqivalent. Without using jython, this function works. I don't know how i can do it, in another way, to apply jythonc interpreter on this function. import struct def pack (n) : # 0 <= n <= 2 ** 64 - 1 # Convert a 'long' in an 'unsigned long long' C equivalent # Representation on 8 octets p_low = n & (2L ** 31 - 1) p_high = (n & (2L ** 64 - 2L ** 32)) >> 32 return struct.pack ('LL', p_low, p_high) def unpack (s) : # Convert an 'unsigned long long' in a 'long' python equivalent p_low, p_high = struct.unpack ('LL', s) return (p_high << 32) + p_low Thanks a lot, Sebastien Dumont. ```
 Re: [Jython-users] Problem with jython From: Kevin J. Butler - 2002-06-03 19:49:01 ```Duch wrote: > I use the following function to convert a 'long' python equivalent > into an 'unsigned long long' C eqivalent. I'm not sure what this would mean in Jython. CPython's struct module lets you store data in native C data structures (basically laying out data explicitly in memory). Size and layout of these data structures is compiler and platform dependent. Jython doesn't support the struct module, because that would require knowledge of the native platform, and Jython only knows about the Java platform. What is it you're really trying to do? - create native Java objects with particular fields? - create native C objects exposed through Java's JNI? - something else? kb ```