Re: mixing C and C++ in CircleMUD

From: Chris Gilbert (chris@buzzbee.freeserve.co.uk)
Date: 03/07/01


On Wednesday 07 March 2001  2:46 am, Ed Michalski wrote:
> Just wanted to find out how the developers here feel about mixing C++ with
> the 'C' circle stock.  I understand the name mangling might not be a
> handled exactly the same way across all compilers, any pointers to making
> it as portable as possible using the mix?

I belive that if you use g++ (gnu c++ compiler) then you should be able to
mix the 2 together (use g++ to compile the c files as well, then everything
gets name mangled and works).  I certainly have done so in the past.  It
makes certain things seem a lot tidier.  Stick to standard C++ and STL and
you should keep fairly portable.  Oh and use the latest version of g++ you
can (2.95.2) as it comes with a more complete STL.  Certainly the standard
things to get portable code are the same, eg use your own types that are of
fixed width etc.

One of the biggest problems I had was mis-matching prototypes due to the
large number of externs in the code that were wrong, some of this my fault,
some of it from snippets.  So you might find that you spend time moving all
the extern lines out into headers.

You might want to look at leximud either that's a circle derived C++ mud.
There's also the source for death gates mud which is derived from an older
bpl of circle, it does use a fairly old style of C++.

Cheers,
Chris

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST