Hello,
I'm facing severe structure padding issues when my Solaris C/C++ application that runs on Sparc communicates with the same C/C++ application that runs on Intel. I know that Sparc and Intel use different padding patterns. So when it comes to reading the exchanged structure data, both machines read the wrong data. The structure that is exhanged between the two machines contains both uint32_t and uint64_t variables.
I could add some extra uint32_t 0s in the structure definition in case of Intel but this is not an actual clean solution.
Aside from alignment issues, you may also have to consider endianness. Intel x86 is little endian and Sparc may be big endian (some are purely big endian and some are bi).
Hello,
I'm facing structure padding issues when my Solaris 32-bit C/C++ application that runs on Sparc communicates with the same C/C++ application that runs on 32-bit Intel. I know that Sparc and Intel use different padding patterns. So when it comes to reading the exchanged structure data, both machines read the wrong data.
My structure is of the form:
Is there a way to resolve this padding issue?
You cannot safely pass structures/unions/etc between disparate computing platforms in the way that you seem to expect it to work. Aside from endianness issues, there are structure packing and alignment issues, programming model issues, etc.
This problem has been solved a long time ago. Check out IDL - Interface Description Language, RPC, CORBA, etc.
Hello,
I'm facing structure padding issues when my Solaris 32-bit C/C++ application that runs on Sparc communicates with the same C/C++ application that runs on 32-bit Intel. I know that Sparc and Intel use different padding patterns. So when it comes to reading the exchanged structure data, both machines read the wrong data.
My structure is of the form:
Is there a way to resolve this padding issue?
Thanx in advance.
Quote:
Originally Posted by Goseib
Is there a way to resolve this padding issue?
The padding issue is simple to avoid. Simply do not write/read structs. Instead, write/read each member, recursively when a nested struct is encountered.
Since you're using fixed-width numeric types, implementation-defined size variance is not an issue.
However, you still have to worry about endianness if you're reading/writing multibyte types across different hardware platforms (even when they're running the same operating system). In this case, all members of your struct are simple numeric types (flattening the nested struct), so you may be able to write/read them using the standard ntoh*/hton* libc functions if the c libraries of all relevant platforms provide a 64-bit extension. If no 64-bit version of those functions is available, you could play games with casting, pointers, bitmasks, bitshifting, etc ... to massage the 64-bit types into network byte order. Or, perhaps you could avoid all of the above and use an implementation of XDR (or something similar).
In case you you haven't used them, the keywords 'serialization' and 'marshalling' should be helpful in searching/googling for further information on this topic.
Hello friends,
I hope everyone is fine and doing well. I want to learn Assembly language for SPARC architecture. Is there any emulator available for 64 bit SPARC on which one can install Oracle Solaris 11 SPARC version. And ofcourse on my intel laptop computer???
Thanks! (4 Replies)
I have a Sun Blade 1000 machine that I installed Ubuntu 7.10 SPARC onto. The only user configured (configure during install) cannot use sudo. When I try to issue a command using sudo (ex. sudo apt-get install) it asks me for my password and returns the error "user not found in sudoers file". I need... (4 Replies)
Hi,
I have a fixed length text file that needs to be cut into individual files in aix and facing padding issues. If I have multiple blank spaces in the file it is just making it one while cutting the files..
Eg:-
$ - blank space
filename:file.txt
... (2 Replies)
I have a file with records containing dates like:
SMPBR|DUP-DO NOT USE|NEW YORK||16105|BA5270715|2007-6-6|MWERNER|109||||JOHN||SMITH|MD|72211118||||||74559|21 WILMINGTON RD||D|2003-11-6|SL# MD CONTACT-LIZ RICHARDS|||0|Y|N||1411458|
How can I get the date fields in each of my records to be... (1 Reply)
Hi
Can anyone tell me how to pad zeroes on the left side to a numeric string in unix shell scripting
Your answer is very much appreciated
Thanks
Vijay (2 Replies)
Hello,
Structure padding & structure size are different on Compaq & HP UNIX. When structures are transfered via netfork from Compaq to HP will this be a problem? If yes, what can be the solution?
Thanks,
shilpa (2 Replies)
Hello all,
I have been trying to find any data that states what platform would garner better overall performance in an Oracle Cluster.
The scenario:
This is a high traffic e-commerce site with IIS and Commerce server on the front end. The backend consists of a Sun Solaris hardware/software... (7 Replies)