🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50151

passing structures?

#50151
From: Chris Atkins
Date: Tue, 09 Nov 1993 03:45
89 lines
3309 bytes
I am trying to use gcc 2.4.0 to compile some code using the ndbm system calls.

I can not figure out the correct flags to get the datum structure filled in
when making a call to dbm_fetch.

My code looks like the following:

  datum rtn_data;
  datum key;

  rtn_data = dbm_fetch(database, key)

  datum if defined as follows:
  typedef struct {
        char    *dptr;
        int     dsize;
podatum;


The size of the datum structure is 8 bytes.  The system does not pass the 
pointer to the datum structure, but the datum structure itself back to the
user.  I have tried to compile with the -freg-struct-return, -freg-struct-return and niether of these flags.  follwing is the output from gcc -v

        gcc -v -g -fpcc-struct-return -O   -I/usr/include   -DSYSV    -c databas
e.c
Reading specs from /usr/local/lib/gcc-lib/hp720/2.4.0/specs
gcc version 2.4.0
 /usr/local/lib/gcc-lib/hp720/2.4.0/cpp -lang-c -v -I/usr/include -undef -D__GNU
C__=2 -Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOU
RCE -D__hppa__ -D__hp9000s800__ -D__hp9000s800 -D__hp9k8__ -D__PWB__ -D__hpux__
-D__unix__ -D___HPUX_SOURCE__ -D__hppa -D__hp9000s800 -D__hp9000s800 -D__hp9k8 -
D__PWB -D__hpux -D__unix -D___HPUX_SOURCE -D__OPTIMIZE__ -g -D__hp700s700 -D_PA_
RISC1_1 -DSYSV database.c /usr/tmp/cca08807.i
GNU CPP version 2.4.0 (hppa)
 /usr/local/lib/gcc-lib/hp720/2.4.0/cc1 /usr/tmp/cca08807.i -quiet -dumpbase dat
abase.c -g -O -version -fpcc-struct-return -o /usr/tmp/cca08807.s
GNU C version 2.4.0 (hppa) compiled by GNU C version 2.4.0.
database.c: In function `main':
database.c:26: warning: assignment from incompatible pointer type
database.c:29: warning: assignment from incompatible pointer type
 /usr/local/lib/gcc-lib/hp720/2.4.0/as -o database.o /usr/tmp/cca08807.s
        rm -f database; if [ -f database ]; then mv -f database database ~; fi
        gcc -v -g -fpcc-struct-return -o database database.o -O    -lndbm
Reading specs from /usr/local/lib/gcc-lib/hp720/2.4.0/specs
gcc version 2.4.0
 /usr/local/lib/gcc-lib/hp720/2.4.0/ld -u main -a archive -o database /lib/crt0.
o -L/usr/local/lib/gcc-lib/hp720/2.4.0 -L/usr/local/lib database.o -lndbm -lgcc
-lc -lgcc


Following is the specs file:
*asm:


*asm_final:


*cpp:
%{!mpa-risc-1-0:%{!mnosnake:-D__hp700s700 -D_PA_RISC1_1}}

*cc1:
%{pg:} %{p:}

*cc1plus:


*endfile:


*link:
-u main -a archive

*lib:
%{!p:%{!pg:-lc}}%{p:-L/lib/libp/ -lc}%{pg:-L/lib/libp/ -lc}

*startfile:
%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}

*switches_need_spaces:


*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}

*predefines:
-Dhppa -Dhp9000s800 -D__hp9000s800 -Dhp9k8 -DPWB -Dhpux -Dunix -D_HPUX_SOURCE

*cross_compile:
0
Technical Details
Message-ID: <1993Nov9.034546.6099@ods.com>
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!cs.utexas.edu!uunet!ods!chris

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,b55e3937a21d6246,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-11-08 21:36:14 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!cs.utexas.edu!uunet!ods!chris
From: chris@ods.com (Chris Atkins)
Subject: passing structures?
Message-ID: <1993Nov9.034546.6099@ods.com>
Organization: Optical Data Systems, Inc.
X-Newsreader: TIN [version 1.2 PL2]
Date: Tue, 9 Nov 1993 03:45:46 GMT
Lines: 91