Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!liuida!isy!herkules.sssab.se!pausv From: pausv@sssab.se (Paul Svensson) Newsgroups: comp.lang.c Subject: Re: Static Function Invocation Thru Pointer Message-ID: Date: 4 Mar 91 15:56:53 GMT References: <1991Mar3.002250.26164@agate.berkeley.edu> <1991Mar3.010606.20706@zoo.toronto.edu> Followup-To: alt.folklore.computers Organization: Scandinavian System Support AB Lines: 24 henry@zoo.toronto.edu (Henry Spencer) writes: >In article <1991Mar3.002250.26164@agate.berkeley.edu> labc-1ia@web-3g.berkeley.edu (Andrew M. Choi) writes: >>Hi. This article is about the question of invoking a static >>function in another file through the use of pointer to >>function... > >That is perfectly legitimate. If you can get a pointer to it, you can >call it. "static" just means that the *name* is not visible outside the >file where it is defined. I had some fun(?) with this when (de)porting Hack to bsd 2.9... Henry is right, of course, but you shouldn't trust all C implementators to know this. CC on the pdp/11 did this wrong in one case; whe using overlays, functions declared static did not get a "thunk" in the base overlay, and when a pointer to a static function was passed off to someone in another overlay, using it there had interesting results :-) /Paul -- Paul Svensson _ /| - Every absurdity needs a champion to defend it - SM5SJS \'o.0' Scandinavian System Support Fax: +46 13 115193 paul@sssab.se =(___)= Box 535 _ Phone: +46 13 111660 sunic!sssab!paul U SE-581 06 Linkoping, Sweden Home: +46 13 121021