[Arjen Markus] (5 march 2003) It has taken me some (calendar) time to get [Critcl] to understand Fortran, and have it work on various platforms, but it is (almost) ready. The current state: * Critclf (as this version is called) is available for anybody who wants to have a look, it is documented, though some cleaning is necessary. * Support for other platforms than the original Linux/gcc platform is provided by using a package called ''buildtools'' - see [Generic compiling and linking via build tools]. * The advantage of this approach is that the Critcl package itself can be extended easily to support other platforms - by extending the "tool database" in ''buildtools''. * The code is not yet ready for release in the sense that it does behave as a nice package yet (just scripts sourcing each other). * The data types for exchanging data between Tcl and Fortran are somewhat limited, especially where strings are concerned. * The version number is 0.20 (based on Critcl 0.32) If you are interested, then just send me an email ---- [AM] (14 august 2007) The major obstacle in developing something like Critclf is not so much the chain of tools one needs to use (C and Fortran compilers that understand each other, linker), but the bare fact that the interface of a Fortran routine can not easily be understood from the declaration only. For instance: subroutine xyz( x, y, z, n ) real x real y(n) integer z(n,n) integer n end would be callable from C like this: float x, y[10], z[10][10] ; xyz( &x, y, z, &n ) ; but does that indicate that x will be changed within the routine? Or what about the two arrays? For a proper interface with Tcl, one needs to know the ''role'' of the variables: * If you call a Fortran routine from Tcl, then it must be wrapped in a function that acts as a Tcl command * All the input arguments must be copied from Tcl_Objs * All output arguments must be copied into Tcl_Objs Having to specify the ''length'' of arrays as a separate argument is slightly odd, as that information would be the length of the list that holds the values. In other words: you want a Tclish interface: xyz $x $list_of_ys $list_of_zs So, after a long hiatus, I started to think about the issue again. My solution is to generate a wrapper function on the basis of slightly more information than just the syntax of interface: Wrapfort::fproc xyz xyz { real x input real-array y input integer-matrix z input integer n {local size(y)} code {Inevitable, I am afraid} { xyz( &x, y, z, &n ); } } would do the trick (I am writing this from memory, after a holiday, so the details may differ ;)). Okay, you need to know a few bits and pieces about C-Fortran interfacing (unlike Critclf), but most tedious details are taken care of and you can get very Tclish interfaces. [AM] (17 august 2007) Well, a lot of nasty details still await a proper solution, but I have committed the source code and the documentation to [http://ftcl.sf.net] (see the CVS repository of that project). ---- [[ [Category Foreign Interfaces] | [Category Language] ]]