For Programmers: Free Programming Magazines  


Home > Archive > Fortran > June 2004 > Compiling files with Preprocessor commands with DVF 5.0









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Compiling files with Preprocessor commands with DVF 5.0
Dirty Harry

2004-06-25, 7:43 pm

First a little background information:

I am attempting to compile a code that has been primarily developed on
several Unix platforms for the past decade. It's pretty much
basic/standard fortran 77 with a few .F (as opposed to .f) files which
contain C preprocessor directives (#if, #elif, #endif, #include etc.)
to open/read/write binary files differently to achieve a straight
binary output with no extra record markers. On the Unix platforms,
these files are first passed through the C preprocessor automatically
with certain -D provided on the command line.

I am now attempting to compile this under Windows and have done so
using Cygwin and Mingw32 with gcc/g77 but have experienced some
performance problems when compared to a Linux version on the same
machine. So I am attempting to compile with Digital Visual Fortran
5.0 (with Developer Studio 97) on Windows. (Yes, I believe this is a
rather old version, but that is what our office currently has.)
Everything compiles fine except for the files which have the
preprocessing directives.

I have tried setting some of the -D's I use on Unix under the
Predefined Preprocessor Variables under Project -> Settings but get
Bad preprocessor line warnings. Looking under Help, it suggests that
one can use # preprocessor commands. However, there are also !
preprocessor directives. Is the same preprocessor used for both. I
want to stay with the # ones since it works under the Unix platforms
and the whole idea is to have a single source base.

I have been able to use 'fpp' directly in a command prompt and
everything works fine. (I used fpp to generate the appropiate file
which I then added to the DVF Project.) When the compiler is invoked
from Developer Studio, does it not run it through fpp first? does
anyone know what settings I need to make in Developer studio so that
the preprocessor is called and understands the # directives.
Richard Maine

2004-06-25, 7:43 pm

dirty.harry@juno.com (Dirty Harry) writes:

> contain C preprocessor directives (#if, #elif, #endif, #include etc.)
> to open/read/write binary files differently to achieve a straight
> binary output with no extra record markers....


I just have a side comment that probably won't really be of much
immediate help to you now. Someone else might know the actual
answer to your question. Afraid that I don't (even though DVF 5
is also the latest version I have of the compilers on the Windows
side of that particular line).

For applications like this, I prefer to take an approach of
modularizing the system dependency into separate procedures.
That way I don't need to worry about conditional compilation
issues. My "conditional compilation" process is just to select
the appropriate one of multiple versions of the file. Of course,
this only makes sense if you isolate the dependency down to a
small enough file so that you aren't maintaining multiple copies
of big chunks of code.

Sometimes such modularization can be problematic. Preprocessing
as you are doing can be a better option in some cases. But I do
strive for the isolation/modularization approach where practical.

I also well realize that if you've been working with this code for a
decade, you have good reason not to go back and redo such things just
because it is proving slightly awkward with one compiler. So I'm not
really suggesting that you change. Just material for future thought.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Jugoslav Dujic

2004-06-25, 7:43 pm

Dirty Harry wrote:
| First a little background information:
<snip>
| I have been able to use 'fpp' directly in a command prompt and
| everything works fine. (I used fpp to generate the appropiate file
| which I then added to the DVF Project.) When the compiler is invoked
| from Developer Studio, does it not run it through fpp first? does
| anyone know what settings I need to make in Developer studio so that
| the preprocessor is called and understands the # directives.

The magic switch is /fpp :

http://softwareforums.intel.com/ids/board/message?board.id=15&message.id=1187

--
Jugoslav
___________
www.geocities.com/jdujic

Please reply to the newsgroup.
You can find my real e-mail on my home page above.

Dirty Harry

2004-06-25, 7:44 pm

"Jugoslav Dujic" <jdujic@yahoo.com> wrote in message news:<2joek9F12qna2U1@uni-berlin.de>...
> Dirty Harry wrote:
> | First a little background information:
> <snip>
> | I have been able to use 'fpp' directly in a command prompt and
> | everything works fine. (I used fpp to generate the appropiate file
> | which I then added to the DVF Project.) When the compiler is invoked
> | from Developer Studio, does it not run it through fpp first? does
> | anyone know what settings I need to make in Developer studio so that
> | the preprocessor is called and understands the # directives.
>
> The magic switch is /fpp :
>
> http://softwareforums.intel.com/ids/board/message?board.id=15&message.id=1187


I had already tried that. The problem is I can only manually add the
/fpp switch with appropriate /D's when I do Project -> Settings when
the "project" files on the FileView tab is selected (Under the Fortran
tab, the Project options is then editable). However, If I just have
one of the files selected and do a Project -> Settings, the "Source
File Options" area is not editable so I can't manually add the /fpp
switch. If I try the first way, then every other file is passed
through the preprocessor and they are put in the a temporary
directory. The preprocessed file then appears to be attempted to be
compiled from within that temporary directory. However, this bombs
because nearly all of the source files use include's (Fortran
includes) for including common block files which are located in the
source directory and not in the temporary directory.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com