From: The Star King on
On Jul 19, 5:36 pm, "James Van Buskirk" <not_va...(a)comcast.net> wrote:
> "The Star King" <j...(a)npl.co.uk> wrote in messagenews:631eeb7e-fcef-4c40-9e1f-c51a4650200a(a)e5g2000yqn.googlegroups.com...
>
> > This issue hasn't been mentioned for a while so I hope you don't mind
> > me bringing it up again. Has there been any progress made on writing
> > windows api programs using one of the free compilers (g95 or
> > gfortran)? I remember there was some discussion about "decorating"
> > function names and stdcall calling convention.. but it all seemed to
> > come to nothing.
> > Currently I can program windows apps in Intel Fortran or in gcc (using
> > C language) but not in gfortran.
> > Also, is it possible to call OpenGL or DirectX from fortran (Intel or
> > gfortran/gcc?). I'd like to do some 3D graphics eventually.
> > Thanks for your help with this.
>
> I posted an example just a couple of days ago:
>
> http://groups.google.com/group/comp.lang.fortran/msg/fd9d74e75d8fcb23...
>
> OK, so it was a couple of weeks ago.  If all you need to work with
> is 64-bit Windows, it's easy with standard f03 in any compiler that
> implements ISO_C_BINDING.  The example quoted above shows that
> gfortran only needs one extra extension statement per interface
> block to also work with 32-bit Windows.  It's pretty easy to
> convert OpenGL or DirectX C header files to Fortran modules as long
> as you're only trying to do it for the couple of functions that you
> need and not everything at once.
>
> --
> write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
> 6.0134700243160014d-154/),(/'x'/)); end

Thanks for this advice. Have you tried using this technique for
Windows Api programming? I think the key thing is the command

!GCC$ ATTRIBUTES STDCALL

which i wasn't aware of but which is reminiscent of the Intel Fortran !
DEC$ command. (is this a new thing in gcc?). It looks as though I
would have to write a large module full of interface statements
(rather like the one Intel Fortran provides). But has anyone already
written such a module?
From: Tobias Burnus on
The Star King wrote:
> Thanks for this advice. Have you tried using this technique for
> Windows Api programming? I think the key thing is the command
>
> !GCC$ ATTRIBUTES STDCALL
>
> which i wasn't aware of but which is reminiscent of the Intel Fortran !
> DEC$ command. (is this a new thing in gcc?).

Support for the GCC$ directive was added about a year ago (in GCC 4.5),
cf. the release notes: http://gcc.gnu.org/gcc-4.5/changes.html

And indeed GCC$ were motivated by the DEC$ attributes. For GCC/gfortran,
the idea is to use most of BIND(C) and only add the GCC$ attributes on
top of it. For BIND(C) and the GCC$ directives have a look at the first
two items at

http://gcc.gnu.org/onlinedocs/gfortran/Mixed_002dLanguage-Programming.html

Tobias
From: The Star King on
On Jul 19, 5:58 pm, Steve Lionel <steve.lio...(a)intel.invalid> wrote:
> On 7/19/2010 11:13 AM, The Star King wrote:
>
> > Also, is it possible to call OpenGL or DirectX from fortran (Intel or
> > gfortran/gcc?).
>
> Intel Fortran supports OpenGL calls using the IFOPNGL module.  There's
> also f90gl (http://math.nist.gov/f90gl/) though I don't see a build
> script for gfortran on Windows there.  (There is one for Linux.)
>
> Intel Fortran doesn't provide DirectX interfaces, but it should be
> possible to construct your own.
>
> --
> Steve Lionel
> Developer Products Division
> Intel Corporation
> Nashua, NH
>
> For email address, replace "invalid" with "com"
>
> User communities for Intel Software Development Products
>    http://software.intel.com/en-us/forums/
> Intel Software Development Products Support
>    http://software.intel.com/sites/support/
> My Fortran blog
>    http://www.intel.com/software/drfortran

Thanks for that, Steve. I've only recently got IVF and didn't notice
the OpenGL support! I'm now going through the OpenGL code in the
Samples directory. Are there any OpenGL tutorials you would recommend?
Preferably specific to Fortran, though that may be asking too much!
From: glen herrmannsfeldt on
James Van Buskirk <not_valid(a)comcast.net> wrote:
(snip)

> It's pretty easy to
> convert OpenGL or DirectX C header files to Fortran modules as long
> as you're only trying to do it for the couple of functions that you
> need and not everything at once.

It shouldn't be hard to automate the process. Though it may
take some time to check that the automated conversion gave
the right result in all cases.

-- glen
From: GaryScott on
On Jul 19, 12:45 pm, The Star King <j...(a)npl.co.uk> wrote:
> On Jul 19, 5:58 pm, Steve Lionel <steve.lio...(a)intel.invalid> wrote:
>
>
>
>
>
> > On 7/19/2010 11:13 AM, The Star King wrote:
>
> > > Also, is it possible to call OpenGL or DirectX from fortran (Intel or
> > > gfortran/gcc?).
>
> > Intel Fortran supports OpenGL calls using the IFOPNGL module.  There's
> > also f90gl (http://math.nist.gov/f90gl/) though I don't see a build
> > script for gfortran on Windows there.  (There is one for Linux.)
>
> > Intel Fortran doesn't provide DirectX interfaces, but it should be
> > possible to construct your own.
>
> > --
> > Steve Lionel
> > Developer Products Division
> > Intel Corporation
> > Nashua, NH
>
> > For email address, replace "invalid" with "com"
>
> > User communities for Intel Software Development Products
> >    http://software.intel.com/en-us/forums/
> > Intel Software Development Products Support
> >    http://software.intel.com/sites/support/
> > My Fortran blog
> >    http://www.intel.com/software/drfortran
>
> Thanks for that, Steve. I've only recently got IVF and didn't notice
> the OpenGL support! I'm now going through the OpenGL code in the
> Samples directory. Are there any OpenGL tutorials you would recommend?
> Preferably specific to Fortran, though that may be asking too much!- Hide quoted text -
>
> - Show quoted text -

You might also consider GINO which integrates OPENGL (depending on
your budget). With GINO, you program to a single (GINO) API and just
change the driver call at the beginning to switch between for example
win32 GDI or OpenGL. Of course I don't off hand know where the
boundaries are of things you can do with the OpenGl driver that you
can't with the GDI, but its probably in the documentation somewhere.