Code Comments
Programming Forum and web based access to our favorite programming groups.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
Post Follow-up to this messageKay 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 u se > 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. Anybo dy > 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
Post Follow-up to this message"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. Anybod y >can give me some suggestions? Can you use f2j, a Fortran 77 to Java translator, at http://icl.cs.utk.edu/f2j/[/u...ww.newsfeed.com The #1 Newsgroup Service in the World! >100,000 News groups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption = ---
Post Follow-up to this messageOn 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 u se > 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. Anybo dy > 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
Post Follow-up to this messagethanks, 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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.