From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,9a80b8dd0134f87b X-Google-Attributes: gidf7344,public X-Google-Thread: fc89c,9a80b8dd0134f87b X-Google-Attributes: gidfc89c,public X-Google-Thread: f678f,9a80b8dd0134f87b X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,9a80b8dd0134f87b X-Google-Attributes: gidfee84,public X-Google-Thread: 10b612,9a80b8dd0134f87b X-Google-Attributes: gid10b612,public X-Google-Thread: 1014db,9a80b8dd0134f87b X-Google-Attributes: gid1014db,public X-Google-Thread: 1094ba,9a80b8dd0134f87b X-Google-Attributes: gid1094ba,public From: smryan@netcom.com (@#$%!?!) Subject: Re: C calling Fortran 77 shared library on OSF/1 (or DUnix ?) Date: 1996/05/02 Message-ID: #1/1 X-Deja-AN: 152675604 sender: smryan@netcom10.netcom.com references: <4m9s2v$f6u@newton.cc.rl.ac.uk> followup-to: comp.unix.osf.misc,comp.unix.osf.osf1,comp.lang.c,comp.lang.fortran,comp.unix.programmer,comp.unix.ultrix,comp.os.vms organization: The Programmer formerly known as S M Ryan newsgroups: comp.unix.osf.misc,comp.unix.osf.osf1,comp.lang.c,comp.lang.fortran,comp.unix.programmer,comp.unix.ultrix,comp.os.vms : 2) Also any one tried to mix character*(*) array(length) and char *array[] : (or char **array) when making calls from C into Fortran 77 functions ? My fortran is growing hazy, but I think that for character parameters, you pass in both the address of the characters and the string length. For an assumed size string, it uses that as the actual string length. Otherwise it uses whatever the subprogram says the string length should be. The string length could be packed with the characters or a separate parameter. If you need assumed length strings, you're going to have to discover the calling conventions. I don't remember fortran strings as being variable length, that is with a terminating mark or current string length. You're given a character vector and ways to move it around, but not much more. : 3) What do I do with the common blocks when I create the shared library : from its object and 'normal' library parts? Does ld know how to find : the commons and deal with them automatically ? What about block data : units ones ? Fortran common is the same as a c global variable. REAL X,Y,Z COMMON /XYZ/ X,Y,Z is the same as struct {float x,y,z;} xyz; /*or _xyz or xyz_ or _xyz_ or XYZ or ...*/ Fortran is case insensitive. Many compilers downcase the external names. Also many compilers prefix or suffix a '_' to externals to prevent a collision with library entry point. Many c and fortran compilers. So you may have to play games to get the underscores right. The C version of block data is that you only define a global in one file. In other source files, it must be declared extern. I don't know how ld decides which block data to load. Perhaps it only permits one among all the *.o files? -- The Queen who loves, the Queen of life, | smryan@netcom.com PO Box 1563 the Queen who straits, the Queen of strife;| Cupertino, California with gasp of death or gift of breath | (xxx)xxx-xxxx 95015 she brings the choice of birth or knife. | I don't use no smileys