For Programmers: Free Programming Magazines  


Home > Archive > Fortran > July 2004 > Fortran90 to C









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 Fortran90 to C
Winston

2004-07-02, 8:57 pm

Hi, All:

I have a problem regarding Fortran90 to C conversion. To conduct my
research, I have to compile some programs which are written in Fortran90.
However, my computing platfrom only provides C compiler.

The way that I am doing Fortran90 to C conversion is:
using VAST90 (from pacific-sierra research) do the conversion: Fortran90 to
Fortran 77
for example:
vf90 f90prog.f90
I get Vf90prog.f

then
using f2c do the conversion: Fortran77 to C
for example:
f2c -A Vf90prog.f
I get Vf90prog.c

Now I use C ompiler as:
cc -c Vf90prog.c
cc -o executablefile Vf90prog.c
libvast90.a -llibf2c -lm

The library: libvast90.a is required by VAST90 since some intrinsic
functions are handled by the library.

But,
I have the problem to link the library to my C compiler, in the linking step
by cc, I got messages like some functions are undefined.

On the other hand, I tried a Fortran77 program, I was fine using f2c and C
pompiler.

So, how could I let the C compiler know that some functions can be found in
libvast90.a


Appreciate any helps!

Best,
Winston



Richard Maine

2004-07-02, 8:57 pm

"Winston" <winstonli2004@hotmail.com> writes:

> I have a problem regarding Fortran90 to C conversion. To conduct my
> research, I have to compile some programs which are written in Fortran90.
> However, my computing platfrom only provides C compiler.


What platform is that?

> The way that I am doing Fortran90 to C conversion is:
> using VAST90 (from pacific-sierra research) do the conversion: Fortran90 to
> Fortran 77...
> then using f2c do the conversion: Fortran77 to C


Ugh! If you get this to work at all, it will be a pretty bad mess after
going through two separate translations. I'd suggest that you will be
a lot ahead to just figure out how to get a Fortran 90 compiler. Note
that last time I checked, VAST90 was not very robust at all. By the
time you fight with the likely problems from this two-level translation,
I'd wager that, even if you value yourself only at minimum wage, you'd
have paid for a compiler... (even assuming that you can't get a free
one).

> cc -o executablefile Vf90prog.c
> libvast90.a -llibf2c -lm

....
> So, how could I let the C compiler know that some functions can be found in
> libvast90.a


Same way as you tell it that functions can be found in any library.
Looks to me like you did so. I think we'd need a lot more details to
debug this. What functions is it looking for? Are you sure they are
in libvast90.a?

But I'll go back to my original question of what platform you are on
that you don't think you can get f90 compilers for. VAST90 doesn't
run on very many platforms that I recall (no time to go check
specifically right now - gotta run in a minute or two). I'd be
surprised if it ran on any that didn't have f90 compilers available.
Ok, maybe I'll just be surprised. Or perhaps by "my computing
platform only provides C" you just meant that this was the only
compiler currently installed instead of that this was the only
compiler available for that kind of platform. We can help with
questions about what compilers are available.

--
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
Prof. Athanasios Migdalas

2004-07-02, 8:57 pm

Richard Maine wrote:

>
> "Winston" <winstonli2004@hotmail.com> writes:
>
>
> What platform is that?


If you run on a linux platform, why not visit the Intel site for a free
trial of their Fortran 95 compiler?
>

But if you have access to the old Vast translator/compiler, why do you say
that you don't have access to a Fortran compiler?

Try also the g95 and gfortran ... they are free and may work for you.

Lahey may also have a demo f95 compiler. And finally you have the F
compiler, which is also free. Visist www.fortran.com

/Sakis
[color=darkred]
>
> Ugh! If you get this to work at all, it will be a pretty bad mess after
> going through two separate translations. I'd suggest that you will be
> a lot ahead to just figure out how to get a Fortran 90 compiler. Note
> that last time I checked, VAST90 was not very robust at all. By the
> time you fight with the likely problems from this two-level translation,
> I'd wager that, even if you value yourself only at minimum wage, you'd
> have paid for a compiler... (even assuming that you can't get a free
> one).
>
> ...
>
> Same way as you tell it that functions can be found in any library.
> Looks to me like you did so. I think we'd need a lot more details to
> debug this. What functions is it looking for? Are you sure they are
> in libvast90.a?
>
> But I'll go back to my original question of what platform you are on
> that you don't think you can get f90 compilers for. VAST90 doesn't
> run on very many platforms that I recall (no time to go check
> specifically right now - gotta run in a minute or two). I'd be
> surprised if it ran on any that didn't have f90 compilers available.
> Ok, maybe I'll just be surprised. Or perhaps by "my computing
> platform only provides C" you just meant that this was the only
> compiler currently installed instead of that this was the only
> compiler available for that kind of platform. We can help with
> questions about what compilers are available.
>


Wolfgang

2004-07-12, 8:59 am

Try FOR_C from Cobalt Blue.

http://www.cobalt-blue.com

They are just adding more and more F90 features to their
FORTRAN to C converter.
it creates very nice C-Code.

Wolfgang


"Prof. Athanasios Migdalas" <migdalas@ergasya.tuc.gr> wrote in message news:<1088811368.139777@athnrd02.forthnet.gr>...[color=darkred]
> Richard Maine wrote:
>
>
> If you run on a linux platform, why not visit the Intel site for a free
> trial of their Fortran 95 compiler?
>
> But if you have access to the old Vast translator/compiler, why do you say
> that you don't have access to a Fortran compiler?
>
> Try also the g95 and gfortran ... they are free and may work for you.
>
> Lahey may also have a demo f95 compiler. And finally you have the F
> compiler, which is also free. Visist www.fortran.com
>
> /Sakis
>
> ...
beliavsky@aol.com

2004-07-12, 4:03 pm


vwt@gmx.net (Wolfgang) wrote:
>Try FOR_C from Cobalt Blue.
>
>http://www.cobalt-blue.com
>
>They are just adding more and more F90 features to their
>FORTRAN to C converter.
>it creates very nice C-Code.


Looking at http://www.cobalt-blue.com/fsmain.htm , I don't think FOR_C handles
ALLOCATABLE arrays, MODULEs, array operations, and other key F90 features.
It is unlikely to be useful to someone who has used modern Fortran.

If one must translate a Fortran 90 code to readable C++, I think that finding
a good C++ matrix/vector library is an important step, so that the code can
be kept at a high level of abstraction. I have no experience with this, however.



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Sponsored Links







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

Copyright 2008 codecomments.com