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: Extra bytes in OSX vs classic binaries



Please excuse me for piggy-backing, but I have a similar issue for which
list members may know the answer.

I have a Fortran 77 code that I compile with g77-3.5. The program can write
binary output files for reading by a post-processor (GMV). The
post-processor is C code, probably compiled with gcc. Apparently the g77
binary file format differs from the gcc binary file format as described in
this thread. As a result the C language post-processor can't read the g77
binary output, and I'm forced to use ASCII instead. As far as I know, the
post-processor won't read .hdf files, either.

My question: are there compiler switches for g77 that will allow the g77
binary output files to be compatible with gcc, similar to the -N3 Absoft
option described below? Any tricks? How about running the particular g77
output routine through f2c and then compiling it with gcc?

Any suggestions will be appreciated.

Joe Koski

on 6/24/04 12:56 PM, Roy Mendelssohn at email@hidden wrote:

> The information at the beginning and end of the block is "record
> length" information. Assuming you are using Absoft version 8 or
> later, compile your program with the -N3 option, and open the file as
> sequential, unformatted. Then the two systems should be compatible.
>
> HTH,
>
> -Roy M
>
>
> At 11:24 AM -0700 6/24/04, SeaSoft Systems wrote:
>> I am porting to OSX some legacy F77 code that was developed using
>> the Absoft compiler on Mac OS 6 through OS 9.
>>
>> As a first step, I have been playing with G77 and PB and am having
>> reasonable success. I got a test application up and running but
>> encountered the following odd circumstance:
>>
>> The F77 code reads and writes raw binary data files as input and
>> output. These are read and written as a stream of 4-byte integers
>> (they are simply copies of a contiguous block of COMMON data).
>>
>> The binaries produced by the G77 version of code have an extra
>> 4-byte chunk of data prepended at the front, and an *identical*
>> 4-byte chunk appended to the end of each binary data file, so the
>> data files produced by the G77-OSX version are exactly 8 bytes
>> larger than the binaries produced by the Absoft code running under
>> classic on the same machine. Other than these 8 errant bytes, the
>> data files are, by actual inspection, identical.
>>
>> Obviously, this circumstance renders data file transport between the
>> classic and OSX platforms very problematic.
>>
>> The 4-byte chunk appears to be a pointer to the end of the data
>> since its decimal representation is exactly one less than the data
>> size, plus 4 extra bytes for the appended chunk, in bytes (i.e.,
>> the classic data file size is 5544 bytes, the OSX data file is 5544
>> +8 = 5552 bytes, and the value of both (fore and aft)
>> data-file-bracketing chunks is 0x[00][00][15][AB] = 5547 decimal.
>>
>> Can anyone explain what this is all about and how I might get rid of
>> those offending extra bytes without OSX-specific code modifications?
>> A compiler flag of some sort perhaps (I couldn't find anything that
>> looked remotely applicable in man G77)?
>>
>> Thanks for any guidance,
>>
>> Richard Hartman
>> _______________________________________________
>> fortran-dev mailing list | email@hidden
>> Help/Unsubscribe/Archives:
>> http://www.lists.apple.com/mailman/listinfo/fortran-dev
>> Do not post admin requests to the list. They will be ignored.
_______________________________________________
fortran-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/fortran-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Extra bytes in OSX vs classic binaries (From: Roy Mendelssohn <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.