Home > Archive > Fortran > October 2004 > fortran with Java?
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 |
fortran with Java?
|
|
|
| Hello all:
I need to use some Fortran package(source code) in Java. I am not familiar
with Fortran.
I am wondering what is the best way to do it. I tried f2c and planned to use
the Java native interface. Unfortunately I couldn't get the c lib and the
f2c lib to link successfully with the c wrapper in Microsoft studio. Anybody
can give me some suggestions?
thanks,
-Kay
| |
| Arjen Markus 2004-10-13, 3:56 am |
| Kay wrote:
>
> Hello all:
>
> I need to use some Fortran package(source code) in Java. I am not familiar
> with Fortran.
> I am wondering what is the best way to do it. I tried f2c and planned to use
> the Java native interface. Unfortunately I couldn't get the c lib and the
> f2c lib to link successfully with the c wrapper in Microsoft studio. Anybody
> can give me some suggestions?
>
> thanks,
> -Kay
Well, the easiest way is to define a C wrapper that calls the Fortran
routines
directly, rather than translate the Fortran code into C as f2c does.
There are plenty of resources available on how to do that.
Regards,
Arjen
| |
| beliavsky@aol.com 2004-10-13, 9:09 am |
|
"Kay" <kangkang@interchange.ubc.ca> wrote:
>Hello all:
>
>I need to use some Fortran package(source code) in Java. I am not familiar
>with Fortran.
>I am wondering what is the best way to do it. I tried f2c and planned to
use
>the Java native interface. Unfortunately I couldn't get the c lib and the
>f2c lib to link successfully with the c wrapper in Microsoft studio. Anybody
>can give me some suggestions?
Can you use f2j, a Fortran 77 to Java translator, at http://icl.cs.utk.edu/f2j/
?
----== 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 =---
| |
| Scott Robert Ladd 2004-10-13, 9:09 am |
| On Tue, 12 Oct 2004 22:29:13 -0700, Kay wrote:
> I need to use some Fortran package(source code) in Java. I am not familiar
> with Fortran.
> I am wondering what is the best way to do it. I tried f2c and planned to use
> the Java native interface. Unfortunately I couldn't get the c lib and the
> f2c lib to link successfully with the c wrapper in Microsoft studio. Anybody
> can give me some suggestions?
I do this kind of work, as a contractor, so I've had some experience.
My first suggestion: Write a C "wrapper" for the Fortran code,
exposing the underlying Fortran methods through calls to JNI C routines.
This eliminates the need to write any Fortran, but does require you to
write C.
You could use a Fortran-to-Java translator like F2J (see
http://icl.cs.utk.edu/f2j/) That program only translates a subset of
Fortran 77, but it might be sufficient for your needs.
One advantage of Fortran libraries is their stability and reliability; any
translation might introduce new bugs. How large is the Fortran library?
Another technique is to communicate between a Java
wrapper and the Fortran via some mechanism such as pipes or SOAP. That,
however, requires writing some Fortran, which may not be an option in your
case.
--
Scott Robert Ladd
site: http://www.coyotegulch.com
blog: http://chaoticcoyote.blogspot.com
| |
|
| thanks, I actually got the f2c stuff to work later...However, option one
sounds good too. I'll try it if the f2c stuff is not satisfactory.
-Kay
|
|
|
|
|