Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #17931

Re: macro prototype

Message-ID <4F4901E7.5DFD@mindspring.com> (permalink)
Date 2012-02-25 10:44 -0500
From pete <pfiland@mindspring.com>
Organization PF
Newsgroups comp.lang.c
Subject Re: macro prototype
References <8eb7078a-779c-4baa-92aa-0bacac4885ff@r1g2000yqk.googlegroups.com>

Show all headers | View raw


ashu wrote:
> 
> Hi all,
> I want to use a macro which I want to define in a .c(lets call it
> macro.c) file instead of a .h(macro.h) file because it uses some local
> variables which are defined in the .c file. However I want this macro
> to be visible to other files which will include the
> corresponding .h(macro.h) file.
> 
> The problem here is since the macro is defined in the macro.c file and
> there is no way I can declare a prototype of the macro in the macro.h
> file, this macro cannot be invoked by other files since the other
> files simply include the macro.h file.
> 
> Is there anyway I can get around this problem ?

Declare the local variables as "extern"
in the macro.h file 
and define the macro in macro.h also.


-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

macro prototype ashu <ashutosh.ghildiyal@gmail.com> - 2012-02-24 02:36 -0800
  Re: macro prototype Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-24 03:34 -0800
  Re: macro prototype Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-02-24 11:38 +0000
  Re: macro prototype Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-24 07:49 -0500
    Re: macro prototype ashu <ashutosh.ghildiyal@gmail.com> - 2012-02-24 08:31 -0800
  Re: macro prototype Ya Shou <shouyatf@gmail.com> - 2012-02-25 05:52 -0800
  Re: macro prototype pete <pfiland@mindspring.com> - 2012-02-25 10:44 -0500

csiph-web