From: CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-GCC-REQUEST" 18-MAR-1991 21:32:20.18 To: ARISIA::EVERHART CC: Subj: I want to call a struct-valued library function on a sparc. From: help-gcc-request@prep.ai.mit.edu@SMTP@CRDGW2 To: Everhart@Arisia@MRGATE Received: by crdgw1.ge.com (5.57/GE 1.91) id AA25467; Mon, 18 Mar 91 21:22:34 EST Received: by life.ai.mit.edu (4.1/AI-4.10) id AA05756; Mon, 18 Mar 91 20:16:44 EST Return-Path: Received: from tut.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA05740; Mon, 18 Mar 91 20:15:56 EST Received: by tut.cis.ohio-state.edu (5.61-kk/5.910301) id AA14974; Mon, 18 Mar 91 20:12:45 -0500 Received: from USENET by tut.cis.ohio-state.edu with netnews for help-gcc@prep.ai.mit.edu (help-gcc@prep.ai.mit.edu) (contact usenet@tut.cis.ohio-state.edu if you have questions) Date: 18 Mar 91 22:58:01 GMT From: netnews!mjd@noc2.dccs.upenn.edu (Mark-Jason Dominus) Organization: University of Pennsylvania Subject: I want to call a struct-valued library function on a sparc. Message-Id: Sender: help-gcc-request@prep.ai.mit.edu To: help-gcc@prep.ai.mit.edu Sun has a library called `ndbm' which provides fast hashed database storage and access. Some of the routines (e.g., `dbm_firstkey()', `dbm_nextkey()') return a struct { char *dptr; int dsize; } ; My gcc-compiled calling routine doesn't get the right structure returned from these routines, either with or without -fpcc-struct-return. The GCC info file (node `Incompatibilities') says: On the Sparc, GNU CC uses an incompatible calling convention for structures. It passes them by including their contents in the argument list, whereas the standard compiler passes them effectively by reference. This really ought to be fixed, but such calling conventions are not yet supported in GNU CC, so it isn't straightforward to fix it. The convention for structure returning is also incompatible, and `-fpcc-struct-return' does not help. Is there a workaround that is better than each of: ``use another compiler'' ``use another architecture'' ``rewrite the library routine'' ? -- Nihil tam absurde dici potest, quod non dicatur ab aliquo pilosophorum. Mark-Jason Dominus mjd@central.cis.upenn.edu