Mail Archives: djgpp/1996/10/12/01:40:02
In article <1 DOT 5 DOT 4 DOT 16 DOT 19961011134329 DOT 0a370e00 AT dmeasc DOT rc DOT ipt DOT br>,
Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br> wrote:
>At 11:09 11/10/96 GMT, Chris Waters wrote:
>>In any case, since this is an initializer for a (presumably) global data
>>element, why don't you put it in a separate file by itself and compile
>>just that file as C.
>Or perharps just wrap the declaration with extern "C" ?
Do you mean "wrap the definition?" If so, the answer is: because that
won't work. If you'd been following the discussion, you'd know that the
feature in question is a non-standard gcc extension only available in C.
Using extern "C" only affects the name used by the linker; it does not
automatically switch you into C.
If you really did mean "declaration," then the answer is, there's no
"just" about it; you must *also* wrap the declaration with extern "C" in
order to access it from C++. But that discussion is more relevant to
comp.lang.c or comp.lang.c++, and I have been hoping that this fellow
would start to learn something about posting to appropriate groups. :)
cheers,
Chris
- Raw text -