Mail Archives: djgpp/1997/01/16/13:31:49
Daniel Boyer wrote:
>
> My question
> is can I intermix the code or do I have to rewrite it all (I only know
> bare minimal C...I when straight from pascal to C++ without ever being
> taught C, so I don't really want to go back and try to learn C just
> for this program.)? Thanks, Daniel Boyer
It's not very difficult. Take any code that is written in C and wrap
its declaration in "extern C { ... }". This instructs the compiler not
to name-mangle the resulting identifiers according to C++ rules, but
rather to leave them alone and call them as C functions. You need to
put the "extern C" bit in the header file(s) that declare the C
functions.
BTW, this doesn't interfere with those same header files being used for
C programs. Take a look at any of the DJGPP header files to see how
they handle it.
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| Plan: To find ANYONE willing to | http://www.cs.com/fighteer |
| play Descent 2 on DWANGO! | Tagline: <this space for rent> |
---------------------------------------------------------------------
- Raw text -