Home > Archive > Fortran > December 2005 > Fortran 90/95 and network support
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 90/95 and network support
|
|
| Thomas Baruchel 2005-12-09, 7:18 pm |
| Hi,
I posted some time ago about Fortran 77, but now is the same question
concerning Fortran 90 and 95. I am looking for some kind of network
support (purpose is to get some information through a HTTP request);
I would rather like not using any C library and wonder if there are
libraries intended to be used directly in Fortran.
Regards,
--
Thomas Baruchel --- Home Page: http://baruchel.free.fr/~thomas/
write to baruchel at the host called bluebottle dot com
écrire à baruchel chez l'hôte nommé bluebottle point com
(you will be asked for a confirmation the first time you write)
| |
|
|
"Thomas Baruchel" <baruchel@127.0.0.1> wrote in message
news:439a0051$0$11154$626a14ce@news.free.fr...
> Hi,
>
> I posted some time ago about Fortran 77, but now is the same question
> concerning Fortran 90 and 95. I am looking for some kind of network
> support (purpose is to get some information through a HTTP request);
> I would rather like not using any C library and wonder if there are
> libraries intended to be used directly in Fortran.
This option depends on what you are willing to call Fortran. There are
Fortran products for the .NET platform. An example is Lahey/Fujitsu Fortran
for .NET.
>
> Regards,
>
> --
> Thomas Baruchel --- Home Page: http://baruchel.free.fr/~thomas/
> write to baruchel at the host called bluebottle dot com
> écrire à baruchel chez l'hôte nommé bluebottle point com
> (you will be asked for a confirmation the first time you write)
| |
|
|
| David Frank 2005-12-12, 8:17 am |
|
"Thomas Baruchel" <baruchel@127.0.0.1> wrote in message
news:439a0051$0$11154$626a14ce@news.free.fr...
> Hi,
>
> I posted some time ago about Fortran 77, but now is the same question
> concerning Fortran 90 and 95. I am looking for some kind of network
> support (purpose is to get some information through a HTTP request);
> I would rather like not using any C library and wonder if there are
> libraries intended to be used directly in Fortran.
>
> Regards,
>
CVF, Intel compilers have extensions that allow DIRECT API interfacing to
the WinInet.DLL library functions.
Over a year ago I challenged other compiler owners to show us the same
DIRECT interfacing to Windows API functions using extensions of their
compilers and my memory (I may be wrong) but there was no satisfactory
response showing a successful adaptation of below code.
Any compiler supporting F2003 will allow this code to be slightly modified
and be portable but CVF has supported such API interfacing from day one.
e.g. http://home.earthlink.net/~dave_gemini/getfile.f90
| |
| David Frank 2005-12-12, 8:17 am |
|
"David Frank" <dave_frank@hotmail.com> wrote in message
news:m9dnf.3402$Dd2.1283@newsread3.news.atl.earthlink.net...
>
> CVF has supported such API interfacing from day one.
>
> e.g. http://home.earthlink.net/~dave_gemini/getfile.f90
>
I have uploaded the exe resulting from the simple compile/link of
getfile.f90 (above)
>df getfile.f90 /link wininet.lib
to: http://home.earthlink.net/~dave_gemini/getfile.exe
This is a useful windows program for those needing a method to download a
file directly bypassing their browser..
It can be "built-in" to another Fortran program expanding capabilities of
such user programs.
e.g. I use it within my stock market analysis program to download intra-day
data both real-time and at end-of-day.
| |
| Rich Townsend 2005-12-12, 8:17 am |
| David Frank wrote:
> "Thomas Baruchel" <baruchel@127.0.0.1> wrote in message
> news:439a0051$0$11154$626a14ce@news.free.fr...
>
>
>
>
> CVF, Intel compilers have extensions that allow DIRECT API interfacing to
> the WinInet.DLL library functions.
> Over a year ago I challenged other compiler owners to show us the same
> DIRECT interfacing to Windows API functions using extensions of their
> compilers and my memory (I may be wrong) but there was no satisfactory
> response showing a successful adaptation of below code.
> Any compiler supporting F2003 will allow this code to be slightly modified
> and be portable but CVF has supported such API interfacing from day one.
>
> e.g. http://home.earthlink.net/~dave_gemini/getfile.f90
>
How about a F2003-style interfacing to the standard UNIX networking stuff
(sockets, dgrams, etc)? That would be a nice collaborative project for c.l.f,
and a useful one to boot. Anyone interested in contributing?
cheers,
Rich
| |
| Dan Nagle 2005-12-12, 8:17 am |
| Hello,
Rich Townsend wrote:
<snip>
> How about a F2003-style interfacing to the standard UNIX networking
> stuff (sockets, dgrams, etc)? That would be a nice collaborative project
> for c.l.f, and a useful one to boot. Anyone interested in contributing?
Which leads directly to the question,
"To Posix or not to Posix"?
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| Rich Townsend 2005-12-12, 8:17 am |
| Dan Nagle wrote:
> Hello,
>
> Rich Townsend wrote:
>
> <snip>
>
>
>
> Which leads directly to the question,
> "To Posix or not to Posix"?
>
Well, to what level has Posix standardized the networking stuff? Not that
familiar myself -- but it would seem the sensible way to go.
cheers,
Rich
| |
| Richard E Maine 2005-12-12, 7:16 pm |
| Rich Townsend <rhdt@barVOIDtol.udel.edu> wrote:
> Dan Nagle wrote:
>
> Well, to what level has Posix standardized the networking stuff? Not that
> familiar myself -- but it would seem the sensible way to go.
I suspect (but am not at all sure) Dan is referring to POSIX.9, the
POSIX Fortran 77 bindings. I don't recall whether or not that included
networking stuff, but...
If he is referring to POSIX.9, I might suffer the slings and arrows of
outrageous fortune by doing so, but I'll take arms against its sea of
troubles, hoping by opposing to end them. :-)
I am aware that there are at least a few people here of different
opinion, but I personally find the POSIX.9 stuff to be abysmal to the
extent that I decline to use it. Details would take far too long to go
into here (there are a lot of them), and it has been done before. For a
rough outline of my objections, read the rationale appendix of POSIX.9.
I disagree with almost every sentence of the rationale, which makes it
unsurprising that I dislike the result.
That rationale was written as a response to vehement objections to the
original draft of the POSIX.9 standard. Rather than actually change much
of anything, the main response to the objections was to write that
appendix.
And the most fundamental point of contention was that the POSIX.9
standard was written for f77, even though f90 was then the current
Fortran standard. This is more than a token objection, as bindings for
f90 could have been done far more naturally. The f77 binding has pretty
awful hacks around the lack of data structures in f77.
Part of the "defense" for doing an f77 binding was that an f90 one could
later be done to address all the objections to the f77 one. IIRC that
f90 binding was to be POSIX.19, but it never happened.
I don't find it a particularly attractive idea to try to set up an
informal standard (which is what it seems you'd be aiming at) for f2003,
based on a POSIX standard that was made for f77 and specifically
acknowledged in its own appendix to be lacking as an f90 binding.
If Dan is talking about the "regular" POSIX stuff, as opposed to
POSIX.9, then that's another matter, in which case ignore the above
rants.
--
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
| |
| Walter Spector 2005-12-12, 7:16 pm |
| Richard E Maine wrote:
> ...
> I suspect (but am not at all sure) Dan is referring to POSIX.9, the
> POSIX Fortran 77 bindings. I don't recall whether or not that included
> networking stuff, but...
Rest assured that POSIX.9 does not include any socket stuff. Given the
time period that it was authored - late 1980s/early 1990s - I'd imagine
the unix community was still split over streams vs sockets.
> If he is referring to POSIX.9, I might suffer the slings and arrows of
> outrageous fortune by doing so, but I'll take arms against its sea of
> troubles, hoping by opposing to end them. :-)
So maybe someone can show us by example how to write *direct* and *portable*
calls (including derived-type<->struct translation and access to the dozens of
manifest constants) to the socket routines using F2003 C Interop? (And remember
that the various constants, typedefs, and struct definitions DO VARY from system
to system...)
Or is the intent that one still needs intermediate "glue routines" (e.g., something
PXF-like) to make it work?
Walt
| |
| Dan Nagle 2005-12-12, 7:16 pm |
| Hello,
Walter Spector wrote:
<snip>
> So maybe someone can show us by example how to write *direct* and *portable*
> calls (including derived-type<->struct translation and access to the dozens of
> manifest constants) to the socket routines using F2003 C Interop? (And remember
> that the various constants, typedefs, and struct definitions DO VARY from system
> to system...)
You might check http://users.erols.com/dnagle/f2000.html
for a few examples f2k.
The pthreads example is most likely closest to the current topic.
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| Walter Spector 2005-12-12, 7:16 pm |
| Dan Nagle wrote:
>
>
> You might check http://users.erols.com/dnagle/f2000.html
> for a few examples f2k.
>
> The pthreads example is most likely closest to the current topic.
The VERY FIRST TWO manifest constants that I checked:
> integer, public, parameter :: pthread_create_detached = 0
>
> integer, public, parameter :: pthread_create_joinable = 1 ! default
are different than my home system. (Cygwin on Windows.)
On Cygwin, the constants in question are defined in <pthreads.h> as:
#define PTHREAD_CREATE_DETACHED 1
/* the default : joinable */
#define PTHREAD_CREATE_JOINABLE 0
Doesn't sound very 'portable' to me...
Walt
| |
| Dan Nagle 2005-12-12, 7:16 pm |
| Hello,
Walter Spector wrote:
<snip>
> On Cygwin, the constants in question are defined in <pthreads.h> as:
>
> #define PTHREAD_CREATE_DETACHED 1
> /* the default : joinable */
> #define PTHREAD_CREATE_JOINABLE 0
>
> Doesn't sound very 'portable' to me...
Nor is there very much Fortran can do about it.
C only defines the effects of including the header file,
and compiling. You will have to fiddle a bit, for your system.
I hope that's explained in the comments.
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| Arjen Markus 2005-12-13, 4:13 am |
| Sounds to me that you need a platform-specific piece of code here.
One relatively easy way to do it:
Make a small C program that writes out the manifest constants to
a small Fortran module, based on what it finds in the header files:
#include <pthread.h>
#include <stdio.h>
int main( int argc, char *argv[] ) {
FILE *outfile ;
outfile = fopen( "pthread.f90", "w" ) ;
fprintf( outfile, "\
module pthread_constants\n" ) ;
fprintf( outfile, "integer, parameter :: PTHREAD_CREATE_DETACHED =
%d\n", PTHREAD_CREATE_DETACHED ) ;
...
fprintf( outfile, "end module pthread_constants\n" ) ;
}
Of course, untested, but you get the drift, I hope.
Regards,
Arjen
|
|
|
|
|