Gary Scott wrote:

Liam Healy wrote:

I am very interested in this for a project of increasing urgency.  A few
months ago
I found the two links that the other emails mentioned, but found both of
them
inadequate and not well documented.  I think a  complete, documented
F95 API would be very useful.  I am willing to help and critique as time
allows;
I would be using gfortran on linux/amd64 if that makes a difference.


I like Arjen's project as it mirrors my design thoughts somewhat. I am however unsure how it can be done in a compiler independent manner (I see no such markup in Arjen's work, however, so what am I missing?). The Fortran standard does not guarantee any particular argument passing mechanism. It might use pass by reference or value or register at its own choosing depending on many factors, including optimization settings. There is no standard way for the application programmer to choose. Each compiler vendor provides it's own unique method of adjusting calling mechanisms and many do not by default match C. Some compiler's are now beginning to support standard conforming mechanisms (which may not cover all cases still), but that will be rare for a year or two. I'll be out of town for the next week, hoping for approval to use SQLite in my project. Without that approval, my incenstive will be less. I do see this as an important need however.

Let me first tell you that I was inspired by Al Danial's work on a FORTRAN 77 interface for SQLite. I felt however that with Fortran 95 a more generic interface would be possible and that is what I implemented. I have ample experience with combining C and Fortran routines on a variety of platforms and the concerns Gary has are taken care of in
this implementation, though not in the most general way possible:
- I prefer putting the compiler-dependent parts in the C code
- On Windows you need to specify a particular calling convention (__stdcall), rather than the default. On UNIX and Linux there is no such distinction. I take care of that via the macro FTNCALL in csqlite.c - Various Fortran compilers use different "name mangling" schemes - the name of a routine is decorated with one and sometimes two underscores or the name is capitalised. This is taken care of in the C code
 but not completely.
- There is also the matter of passing the implicit length of strings. This is done via the macro INBETWEEN: some Fortran compilers put the length directly after the string argument, others do it by appending these
 hidden arguments at the end.
- Note that the C routines have interfaces that are compatitble to FORTRAN 77 (i.e. no intent, no derived types,
 ...)
- The code should work alright on 64-bits machines (one of the things I adopted from Al's work)

Liam,

could you explain in some detail what you find inadequate? I know I should add more documentation, but the functions as implemented ought to be useful enough. I have not much experience with building extensive database applications, so that may show in the implementation. But I welcome comments and will revive
the work on this interface.

Regards,

Arjen


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to