Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!wuarchive!cs.utexas.edu!uunet!shelby!agate!usenet From: labc-1ia@web-3g.berkeley.edu (Andrew M. Choi) Newsgroups: comp.lang.c Subject: Static Function Invocation Thru Pointer Message-ID: <1991Mar3.002250.26164@agate.berkeley.edu> Date: 3 Mar 91 00:22:50 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Distribution: usa Organization: University of California, Berkeley Lines: 40 Hi. This article is about the question of invoking a static function in another file through the use of pointer to function. Please consider the following: /* In file "foo.c" */ int (*function_pointer)(); static int function() { printf("This is from function\n"); } setFunctionPointer() { function_pointer = function; } /* In file "bar.c" */ main() { extern int (*function_pointer)(); setFunctionPointer(); (*function_pointer)(); /* Is this legal? Note that "function" */ /* is a static function .. unknown to */ /* "bar.c" */ } Personally, I think the above is *ALWAYS* legal (can't think of any reason why this will fail). Is this true for all machine architectures? I thank you in advance for your help. Name: Andrew Choi Internet Addr: achoi@cory.berkeley.edu Tel: (415)848-5658 #include