HP3000-L Archives

November 2000, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Tue, 21 Nov 2000 09:33:09 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (116 lines)
From: "Emerson  Tom # El Monte" <[log in to unmask]>

>I'm encountering a strange problem calling the system intrinsic HPCIGETVAR
>from within a "C" program compiled with the gnu gcc compiler [2.95.2]  The
>program is aborting from within the SYSTEM code, not my user code, so it
>makes it difficult to debug "as a user"...

Gavin's out, so I'll respond on his behalf:

You're probably not declaring the hidden param required for this procedure.
CSEQ (from Lund) reports:

CSEQ [2.4] - LPS Toolbox [A.03b]            (c) 1995 Lund Performance Solutions

For Help at the CSEQ prompt enter   ?
CSEQ [nm]: set gcc
ok

Option settings:
   C               : reset
   EXTRAS          : SET
   EXTRASONLY      : reset
   GCC             : SET
   LANGuage        : reset
   MACro           : reset
   NM              : SET
   PARMS           : SET
   PARMTRUNC       : SET
   PE              : reset
   SORT            : SET
   UNNAMED         : reset

CSEQ [nm, gcc]: hpcigetvar
#include "/usr/contrib/intrinsics/types.h"

extern void HPCIGETVAR (
   int32     num_actual_parms,            /* R26 */
   void     *varname,                     /* R25 */
   void     *status,                      /* R24, @32 -> 32 = NIL */
   int32     keyword1,                    /* R23 = 0 */
   void     *keyvalue1,                   /* SP-$0034 = NIL */
   int32     keyword2,                    /* SP-$0038 = 0 */
   void     *keyvalue2,                   /* SP-$003c = NIL */
   int32     keyword3,                    /* SP-$0040 = 0 */
   void     *keyvalue3,                   /* SP-$0044 = NIL */
   int32     keyword4,                    /* SP-$0048 = 0 */
   void     *keyvalue4,                   /* SP-$004c = NIL */
   int32     keyword5,                    /* SP-$0050 = 0 */
   void     *keyvalue5,                   /* SP-$0054 = NIL */
   int32     keyword6,                    /* SP-$0058 = 0 */
   void     *keyvalue6);                  /* SP-$005c = NIL */
   /*  varname: up to 255 chars, terminate with blank/null.                */
   /*  keyword/value pairs:                                                */
   /*     0, n.a.: ignore pair                                             */
   /*     1, I32 : variable value if number, else 0.                       */
   /*     2, CA255: variable value if string (else null).                  */
      /* extensible 14 */
<output flushed>

CSEQ [nm, gcc]:

Notice that the first parameter is num_actual_parms. In this case,
it is 14 and is something that the HP compiler provides for you
automatically. With GCC, you must do that yourself and supply
the missing/unused parameters.

Here is a technique that I generally use in such a case:

#ifdef __GNUC__
#define _HPCIGETVAR(name, status, keyword1, keyvalue1, keyword2, keyvalue2) \
                HPCIGETVAR(14,name,status,              \
                                keyword1,keyvalue1,     \
                                keyword2,keyvalue2,     \
                                0,0,0,0,0,0,0,0)

extern void HPCIGETVAR(int num_actual_parms,
                        void    *varname,
                        void    *status,
                        int      keyword1,
                        void    *keyvalue1,
                        int      keyword2,
                        void    *keyvalue2,
                        int      keyword3,
                        void    *keyvalue3,
                        int      keyword4,
                        void    *keyvalue4,
                        int      keyword5,
                        void    *keyvalue5,
                        int      keyword6,
                        void    *keyvalue6);

#else
#pragma intrinsic HPCIGETVAR
#define _HPCIGETVAR HPCIGETVAR
#endif

main() {
  char name[] = "myvar";
  int  strlen = 80;
  char buf[80];
  int  status;

  _HPCIGETVAR(name, &status, 10, &strlen, 2, buf);

  printf("var: %s, valuue: %s\n",name,buf);
}

Hope that helps.

see http://www.gccsupport.com for other information.

Regards,


M.

ATOM RSS1 RSS2