Print

Print


Would you or Aleksander like to write an article for
Fortran Forum? This sounds like a very good candidate. 

Cheers

Ian Chivers 

-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of
Ian Bush
Sent: 14 November 2005 09:37
To: [log in to unmask]
Subject: Re: Examples/tests for C interoperability

On Sunday 13 November 2005 02:37, Aleksandar Donev wrote:
> Richard E Maine wrote:
> 
> > 2. Faking procedure pointers. From dlsym you get back the address of 
> > the procedure to be called. How to then call a procedure with that 
> > address is ... tricky. This should become a lot simpler with the 
> > procedure pointers and C interop stuff in f2003.
> Several compilers are coming out with implementations of the C Interop 
> stuff in F2003. Some are running beta tests now. This dl_open stuff 
> sounds like a great example/test to include in a test suite for UNIX 
> platforms. I also plan to write a test interface to a subset of OpenGL 
> to test the ability to directly call the C routines instead of using 
> wrappers. Are there other interesting tasks that people use 
> non-portable hacks to do which would be easier done by interfacing to 
> (standard) C (with standard/common libraries)? I will try to come up 
> with a mini example/test suite in the near future.
> 

I have written using the C interop stuff a module that allows Fortran people
fairly straightforward access to Unix shared memory segments. It's designed
so that MPI programs that have large replicate structures need only keep one
copy per SMP, rather than per process. The Fortran program decalres the
relevant array as a POINTER, calls a routine to allocate it, and then uses
it as normal. I also provide synchronization operations, e.g. critical
regions. If anybody is interested I've written some documentation.

I've only tested it under IBM's xlf 9 so far, but if anybody could point me
in the direction of other compilers that are bringing out the C interop
stuff I would be very interested,

Ian