From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Steve Feehan Newsgroups: gmane.os.tru64.managers Subject: stat is a macro Date: Fri, 29 Nov 2002 18:20:39 -0500 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <20021129232039.GA81744@structure.sbb.uvm.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1038611928 1066 80.91.224.249 (29 Nov 2002 23:18:48 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 29 Nov 2002 23:18:48 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.20.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 18HuPG-0000H0-00 for ; Sat, 30 Nov 2002 00:18:46 +0100 Original-Received: (qmail 16633 invoked by uid 5); 29 Nov 2002 23:20:47 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 16624 invoked by uid 49493); 29 Nov 2002 23:20:47 -0000 Original-Received: from sfeehan@sbb.uvm.edu by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.51. spamassassin: 2.50-cvs. Clear:SA:0(-7.2/5.0):. Processed in 0.374004 secs); 29 Nov 2002 23:20:47 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 29 Nov 2002 23:20:47 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #39060) with ESMTP id <0H6D0057W26MQ8@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 29 Nov 2002 18:20:46 -0500 (EST) Original-Received: from structure.sbb.uvm.edu (sbbf.uvm.edu [132.198.90.210]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #39060) with ESMTP id <0H6D0063J26FNA@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 29 Nov 2002 18:20:40 -0500 (EST) Original-Received: (from sfeehan@localhost) by structure.sbb.uvm.edu (8.9.3/8.9.3) id SAA83114 for tru64-unix-managers@ornl.gov; Fri, 29 Nov 2002 18:20:39 -0500 (EST) Original-To: tru64-unix-managers@ornl.gov Content-Disposition: inline User-Agent: Mutt/1.4i Xref: main.gmane.org gmane.os.tru64.managers:2600 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:2600 I've seen several posts regarding the fact that stat, lstat and fstat are macros wrapping the _F64_* functions. This works fine with the compaq c compiler, and with gcc as long as the address of the function isn't taken. In this case, the compaq compiler knows what to do. But how to fix the gcc case? The answer I've seen in other posts is "use the compaq compiler". No. :) As an example of the code I'm refferring to: #include #include #include int main(int argc, char * argv[]) { struct stat sbuf; int err; int (*stat_fun)(const char *, struct stat *) = stat; err = stat_fun("/dev/null", &sbuf); if (err < 0) { perror("stat_fun"); return 1; } return 0; } What is the "correct" way to make this work with gcc (or other non-compaq compilers)? Thanks and I will summarize. -- Steve Feehan Unix Systems Administrator Structural Biology and Bioinformatics University of Vermont