C Header protocol

Roger Oberholtzer roger
Wed May 4 02:38:42 PDT 2005


On Tue, 2005-05-03 at 16:50, Ben Duncan wrote:
> Ok, I am deep in re-writing SLAG.
> 
> I will have a "Menu Program" and a  "menu module" (.so).
> The idea being that the "module" will contain all of
> the functions to handle the menu'ing stuff, but be a S-Lang loadable module.
> The "Program" will be simply a stand alone Program linked with/to the
> module to run from a command line a SLAG Menu definition.
> 
> I have defined a menu.h that contains the structures and other such stuff.
> 
> Now in the menu module, I have defined the prototypes at the top of the
> program for the routines contained in the program. I have defined
> in the menu.h, the routines in the module as "external ...".
> menu "PROGRAM" will run them out of the module.
> 
> Is this the correct way to do this? Define the prototypes as external
> in a header, even though the header is going to get included in the
> program where the modules truly are defined?

Yep. Welcome to the wonders of C. In the .c file you do not use the
'extern' modifier. Only the global include file. ANSI C compilers figure
this out by themselves. 

+????????????????????????????+???????????????????????????????+
? Roger Oberholtzer          ?   E-mail: roger at opq.se        ?
? OPQ Systems AB             ?      WWW: http://www.opq.se/  ?
? Kapellgr?nd 7              ?                               ?
? P. O. Box 4205             ?    Phone: Int + 46 8   314223 ?
? 102 65 Stockholm           ?   Mobile: Int + 46 733 621657 ?
? Sweden                     ?      Fax: Int + 46 8   314223 ?
+????????????????????????????+???????????????????????????????+



More information about the Linux-users mailing list