Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, DotBot, Yandex

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWFOTE FUSS » Problem with Dynamic Command ...
Forum Rules | Mark all | Recent Posts

Problem with Dynamic Command Supports and g++
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jun 18, 2005, 10:10 pm
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

Okay, so I spent a lot of time get FotE to compile using g++ ....finally get all of the dumb make bugs out of the way and stuff but when i start it up no command works and i have a list in the log with things like:
[*****] BUG: Error locating do_gold in symbol table. ../src/swr: undefined symbol: do_gold


If I change back to gcc everything works fine though....
I was hoping someone could enlighten me on what I need to change to get g++ working properly.

Thanks,
KeB
       
Post is unread #2 Jun 18, 2005, 10:44 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

In the mud.h file, you'll see these 3 lines - chances are you'll need to remove these and get rid of all of the statements which call them further down.

#define DECLARE_DO_FUN( fun )		DO_FUN    fun
#define DECLARE_SPEC_FUN( fun )	SPEC_FUN  fun
#define DECLARE_SPELL_FUN( fun )	SPELL_FUN fun


Then, you'll notice these:

typedef void DO_FUN args( ( CHAR_DATA * ch, char *argument ) );
typedef bool SPEC_FUN args( ( CHAR_DATA * ch ) );
typedef ch_ret SPELL_FUN args( ( int sn, int level, CHAR_DATA * ch, void *vo ) );


What I did for AFKMud 2.0 was change them to this:

#define CMDF( name ) extern "C" void (name)( char_data *ch, char *argument )
#define SPELLF( name ) extern "C" ch_ret (name)( int sn, int level, char_data *ch, void *vo )
#define SPECF( name ) extern "C" bool (name)( char_data *ch )


So now instead of something like this:

void do_look( CHAR_DATA *ch, char *argument )


You end up with something like this instead:

CMDF( do_look )


It wasn't until I had then gone through the code and changed all of the affected functions to be CMDF, SPELLF, or SPECF that the dlsym code worked right again. It's not going to be a fun excersize, but if you plan to use it in conjunction with a g++ codebase, you'll have little choice.
       
Post is unread #3 Jun 19, 2005, 11:30 am
Go to the top of the page
Go to the bottom of the page

Keberus
Conjurer
GroupFUSS Project Team
Posts341
JoinedJun 4, 2005

I would just like to say thanks. After a very exhaustive process of changing all the references I then had to remove all the args() crap that was around many commands as well...but finally I know have a codebase that can compile (and work properly) with gcc and g++.

Thanks,
KeB
       
Post is unread #4 Jun 19, 2005, 1:00 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Heh. I wasn't 100% sure if removing the args() stuff was necessary either even though I had at some point.

You should strongly consider sticking with g++ to compile the code. Keeping it tied to gcc will prevent you from ever using any of the more advanced features of C++ down the road, such as std::string or std::list, vectors, maps, etc. C can't compile those. I've also yet to encounter any system where gcc is installed but g++ is not.
       
Post is unread #5 Oct 6, 2005, 9:20 pm
Go to the top of the page
Go to the bottom of the page

KazRo

GroupMembers
Posts41
JoinedSep 29, 2005

I've done this before, but the problem I run into is that the functions are not all in order, and therefore you have errors calling for functions that are below, (like score calls oldscore, and many times I see do_yell), If possible, I would like to see FotE be configured to compile as both gcc and G++. Then we can write patches to be downloaded (like circle), or just apply common and useful updates to the codebase. Such as dlsym, that way we can cut the work down for people who want alot of the major snippets offered, but not have to spend the hours adding them in.
       
Post is unread #6 Oct 7, 2005, 3:20 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

There's a simple solution to the do_yell type of problem. Instead of formatting your call like so:
do_yell( ch, "Some text here" );
you should try doing it like this:
interpret( ch, "yell Some text here" );


The difference is pretty small but doing this kind of thing where possible will cut way down on the number of DO_FUN declarations you need to keep lying around. There is also the other advantage of now having calls like this more thoroughly checked by the command interpreter to make sure the mob should even be allowed to do it.
       
Pages:<< prev 1 next >>