Mail Archives: djgpp/2001/01/15/00:33:31
At 12:52 PM 01/12/2001 +0200, you wrote:
>> Date: Fri, 12 Jan 2001 08:48:16 +0800
>> From: "Nimrod A. Abing" <n_abing AT ns DOT roxas-online DOT net DOT ph>
>>
>> Now, I've tried doing it using pointers to functions. It works, but
>> (heheheh) is there a better way to do this?
>
>Indeed there is: you need to tell the C++ compiler that the parser is
>a C function, not a C++ function, like this:
>
> extern "C" int my_parser (void);
Thanks Eli, but I wanted to do it (strange as it may seem) the other way
around: Call C++ functions from _within_a_Bison_rule_. A Bison grammar file
gets turned into a C program by the Bison program. Tim Van Holder's
suggestion of using ``extern'' language declarations will not (and does
not) compile because C doesn't recognize the extern "C" construct. Although
I will try out some of his suggestions. It seems that there are two ways to
get this done. One is to use casts here and there, as Tim suggests. On the
other extreme, a complete rewrite and rethinking of the program. The second
alternative should be more viable in the long run. However, since I don't
have the time to do a complete rewrite I might as well stick to using casts
(*ugh*).
nimrod_a_abing
--------------
+========================================+
| Home page: www.geocities.com/n_abing |
+========================================+
ICQ: 54665893
- Raw text -