Re: [sqlite] Fortran 95 Language Bindings
Hi, CVF initially. I will likely transition to IVF once a suitable version is released. Arjen Markus <[EMAIL PROTECTED]> wrote: Gary Scott wrote: > > I do not possess a C compiler, so I will need an all-Fortran solution, > unless the C interface is provided as a compiled binary. > What Fortran compiler do you prefer? I can supply a precompiled C library that should be suitable for a number of Fortran compilers (CVF, IVF on Windows, g95 on Linux/MingW or gfortran on Linux/Cygwin for instance). Regards, Arjen - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Fortran 95 Language Bindings
Arjen Markus wrote: 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) I do not possess a C compiler, so I will need an all-Fortran solution, unless the C interface is provided as a compiled binary. 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] - -- Gary Scott mailto:[EMAIL PROTECTED] dot net Fortran Library: http://www.fortranlib.com Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html If you want to do the impossible, don't hire an expert because he knows it can't be done. -- Henry Ford - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Fortran 95 Language Bindings
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. On 4/14/07, Gary Scott <[EMAIL PROTECTED]> wrote: Hi, this is my first post, so please excuse any etiquette goofs. I'm researching incorporation of SQLite into a project. It would appear relatively straightforward to develop an F95 language binding, however it is likely to be compiler specific (extensions required to adapt calling syntax to C). Is this a suitable place to ask basic C-oriented questions relative to the existing API? Also, it would be my desire to not only map the existing API exactly (as public), but to also create a small additional layer atop the existing API with a slightly higher abstraction level to hide some of the low levelness of the API (pointers, handle passing, etc.). Would anybody be interested in helping or critiquing as I progress? (I haven't decided to do this yet, I'm awaiting corporate approval to use public domain software in my project, which they have refused in the past. This part of the project would be on my own time so as to not involve company ownership issues). -- Gary Scott mailto:[EMAIL PROTECTED] dot net Fortran Library: http://www.fortranlib.com Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html If you want to do the impossible, don't hire an expert because he knows it can't be done. -- Henry Ford - To unsubscribe, send email to [EMAIL PROTECTED] - -- Gary Scott mailto:[EMAIL PROTECTED] dot net Fortran Library: http://www.fortranlib.com Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html If you want to do the impossible, don't hire an expert because he knows it can't be done. -- Henry Ford - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Fortran 95 Language Bindings
Hi, this is my first post, so please excuse any etiquette goofs. I'm researching incorporation of SQLite into a project. It would appear relatively straightforward to develop an F95 language binding, however it is likely to be compiler specific (extensions required to adapt calling syntax to C). Is this a suitable place to ask basic C-oriented questions relative to the existing API? Also, it would be my desire to not only map the existing API exactly (as public), but to also create a small additional layer atop the existing API with a slightly higher abstraction level to hide some of the low levelness of the API (pointers, handle passing, etc.). Would anybody be interested in helping or critiquing as I progress? (I haven't decided to do this yet, I'm awaiting corporate approval to use public domain software in my project, which they have refused in the past. This part of the project would be on my own time so as to not involve company ownership issues). -- Gary Scott mailto:[EMAIL PROTECTED] dot net Fortran Library: http://www.fortranlib.com Support the Original G95 Project: http://www.g95.org -OR- Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html If you want to do the impossible, don't hire an expert because he knows it can't be done. -- Henry Ford - To unsubscribe, send email to [EMAIL PROTECTED] -