3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) (09/01/90)
Where are the linkage conventions of xlc and xlf documented? I occasionally need to write a Fortran-callable primitive in C. The tricky bit this time is for my C code to find the blank common. --P. Asselin, Applied Magnetics Corp.
madd@world.std.com (jim frost) (09/04/90)
3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) writes: >Where are the linkage conventions of xlc and xlf documented? The best documentation on the linkage conventions is in the info document "Subroutine Linkage Conventions". Beware that this document is incorrect in describing the method of passing floats to subroutines and in the calling conventions for varargs functions. I recommend disassembling some simple functions if you want to know how to do those things. If you don't have info online I strongly recommend putting it there despite the disk usage. It's the best documentation I've ever seen for any computer system. Happy hacking, jim frost saber software jimf@saber.com
RAH@IBM.COM ("Russell A. Heise") (10/10/90)
3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) writes: > Where are the linkage conventions of xlc and xlf documented? I > occasionally need to write a Fortran-callable primitive in C. The > tricky bit this time is for my C code to find the blank common. You can find a wealth of information on linkage conventions in InfoExplorer by searching on the keywords "fortran", "linkage", and "convention". For quick access to some important concerns, search separately on the keywords "%VAL" and "%REF". Regarding finding the blank common, in my research, I have found that it is not accessible from C. The simplest solution is to name the common. Once the common is named, you can define it to your C code as a struct with field names matching the names of the common variables. Russ Heise, AIX Technical Support, IBM
3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) (10/11/90)
This was partly a case of RTFM on my part. I eventually found multiple discussions of the interlanguage conventions in the *user's guides* of C, Fortran and Pascal. I had looked only in the reference manuals. Things *not* mentioned are 1) common blocks; 2) interference between C and Fortran I/O. I'll try the keyword searches suggested by Russ Heise. Looking at object files with nm(1), I had figured out how to access labeled Fortran commons from C. The blank common generates a symbol `#BLNK_COM', which is inaccessible from C. I can't use a labeled common because many modules don't know its size at compile time. Instead, I changed the Fortran to pass an extra pointer when it calls C. --P. Asselin