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: 1014db,9a80b8dd0134f87b X-Google-Attributes: gid1014db,public X-Google-Thread: 10b612,9a80b8dd0134f87b X-Google-Attributes: gid10b612,public X-Google-Thread: fee84,9a80b8dd0134f87b X-Google-Attributes: gidfee84,public X-Google-Thread: 1094ba,9a80b8dd0134f87b X-Google-Attributes: gid1094ba,public X-Google-Thread: f678f,9a80b8dd0134f87b X-Google-Attributes: gidf678f,public From: lionel@quark.zko.dec.com (Steve Lionel) Subject: Re: C calling Fortran 77 shared library on OSF/1 (or DUnix ?) Date: 1996/05/06 Message-ID: <4ml47d$dnk@zk2nws.zko.dec.com>#1/1 X-Deja-AN: 154280403 distribution: world sender: lionel@quark.enet.dec.com (Steve Lionel) references: <4m9s2v$f6u@newton.cc.rl.ac.uk> organization: Digital Equipment Corporation, Nashua NH keywords: Fortran 77 common blocks shared library c calling fortran reply-to: lionel@quark.zko.dec.com (Steve Lionel) newsgroups: comp.unix.osf.misc,comp.unix.osf.osf1,comp.lang.c,comp.lang.fortran,comp.unix.programmer,comp.unix.ultrix,comp.os.vms In article <4m9s2v$f6u@newton.cc.rl.ac.uk>, street@wdcc1.bnsc.rl.ac.uk (Rachel Kay Street) writes: |>1) Does anyone know if DEC C manual set for OSF/1 exists as I cannot |> find any bookreader files yet ? If they exist which CD are they on, |> for which OS versions and where ? Because the DEC C compiler is physically included with the Digital UNIX (OSF/1) operating system, and its use is licensed by the "Developers Toolkit" option, the documentation is included on the same CD which holds the operating system documentation. |> |>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 ? |> Do you have an example I could read as all I can do is create core ? |> I have managed to pass single character strings by blank filling and |> null terminating single string in C, with Fortran index searching for |> char(0). Is there a better method as without explicit limits say a |> Fortran print of the string just keeps on printing out memory until |> it dumps core ? |> |>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 ? Please refer to the "Mixed Language Programming" chapter of the DEC Fortran User Manual (on the Layered Products Documentation Library CD) - it contains extensive information on mixing Fortran and C and should answer all of your questions. In particular, it contains detailed examples of passing arrays and character arguments between Fortran and C. ld does know how to find the COMMONs, but of course there should be only one instance of a BLOCK DATA program unit and this should be in the shared library. If you have further questions, feel free to send them to me by mail. -- Steve Lionel mailto:lionel@quark.zko.dec.com Fortran Development http://www.digital.com/info/slionel.html Digital Equipment Corporation 110 Spit Brook Road, ZKO2-3/N30 Nashua, NH 03062-2698 "Free advice is worth every cent" For information on Digital Fortran 90, see http://www.digital.com/info/hpc/f90/