Re: C++ again Daniel W. Burke on Sun, Mar 08, 1998 at 10:51:01PM -0500

From: Eric Green (ejg3@CORNELL.EDU)
Date: 03/08/98


On Sun, Mar 08, 1998 at 10:51:01PM -0500, Daniel W. Burke wrote:
> While researching how well the mud is going to move to c++ immediatly, I
> seem to have come across a problem.  I've compiled a copy of it in g++
> fixing all the errors and most of the warnings (the ones I skipped were
> about using signed and unsigned variables for arithmatic), and when I got it
> done, realizing problems with variables declaired 'const', I can't get a
> function to resolve in dlsym (for elf lib's).  Is there an inherent problem
> with using libdl.so in c++ or is there another lib I should be using for the
> same affect? :)

G++ mangles function names.  You need to either make the functions C
functions (extern "C") or provide mangled names in your table.  You can
use "nm <object file name>" to get the mangled names.  They'll look
something like "postmaster__FP9char_dataPviPcT3".  My specials table is
something like:

#define PROC_ENTRY(proc)        { #proc, #proc "__FP9char_dataPviPcT3", NULL }

struct spec_type spec_mob_table[] =
{
    PROC_ENTRY(postmaster),
    PROC_ENTRY(cityguard),
    PROC_ENTRY(receptionist),
    PROC_ENTRY(cryogenicist),
    PROC_ENTRY(guild_guard),
    PROC_ENTRY(guild),
    PROC_ENTRY(puff),

    { NULL, NULL, NULL }
};


Eric


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST