Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Bing, Yandex, Google

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
481
3,739
19,386
621
KellieBusb
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Smaug Snippets » dlsym
Forum Rules | Mark all | Recent Posts

dlsym
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jun 7, 2003, 9:45 am
Go to the top of the page
Go to the bottom of the page

abadon

GroupMembers
Posts6
JoinedJun 3, 2003

Didn't see this in a previous post, but this or something similar needs to be added in create_mobile function in db.c...
if( pMobIndex->spec_funname )
mob->spec_funname = QUICKLINK( pMobIndex->spec_funname );
       
Post is unread #2 Jun 7, 2003, 9:50 am
Go to the top of the page
Go to the bottom of the page

abadon

GroupMembers
Posts6
JoinedJun 3, 2003

This is in reference to the snippet...
       
Post is unread #3 Jun 10, 2003, 1:22 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Quite correct, nice find. I'll fix it ASAP.
       
Post is unread #4 Jun 11, 2003, 9:41 am
Go to the top of the page
Go to the bottom of the page

Amalric

GroupMembers
Posts48
JoinedMay 15, 2003

Didn't see this in a previous post, but this or something similar needs to be added in create_mobile function in db.c...
if( pMobIndex->spec_funname )
mob->spec_funname = QUICKLINK( pMobIndex->spec_funname );


For those of us who are still learning the mud code... what exactly does that code do and why did it need to be added?
It looks to me like it is insuring that added mobs have the same special function as their prototypes. How close to the truth am I?
--Clueless in Cincinnati
       
Post is unread #5 Jun 11, 2003, 1:12 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Yes, that's exactly what it does. Makes sure that mobs which get loaded have the spec_procs specified by their prototypes.
       
Post is unread #6 Jun 12, 2003, 1:43 am
Go to the top of the page
Go to the bottom of the page

abadon

GroupMembers
Posts6
JoinedJun 3, 2003

Also with the dlsym snippet I had to modify the code function in do_sset. I just made it look like it does in AFKmud codebase. Seemed to work fine.
       
Post is unread #7 Jun 12, 2003, 3:25 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Yeesh. This snippet will be the death of me yet :P

Thanks again. And if you run across any more glaring omissions like that, let me know
       
Post is unread #8 Jun 12, 2003, 4:21 pm
Go to the top of the page
Go to the bottom of the page

Zhamel

GroupMembers
Posts68
JoinedApr 5, 2005

Sorry to ask such a ... newbie type question, but it's not easy learning on your own. I was just wondering how I would clean up this little error. Would like to have as clean as possible compile. I changed do_sset to look like AFK's and got this:
gcc -c -O -g2 -Wall -export-dynamic skills.c
skills.c: In function 'do_sset':
skills.c:1049: warning: implicit declaration of function 'validate_spec_fun'

This is the problem section:
skill->spell_fun_name = str_dup( argument );
}
else if( validate_spec_fun( argument ) )
{
send_to_char( "Cannot use a spec_fun for skills or spells.\n\r", ch );
return;
}
else
       
Post is unread #9 Jun 13, 2003, 3:12 am
Go to the top of the page
Go to the bottom of the page

abadon

GroupMembers
Posts6
JoinedJun 3, 2003

Need to add a function prototype for validate_spec_fun:
In skills.c somewhere at the top around bool check_illegal_psteal( CHAR_DATA *ch, CHAR_DATA *victim );:
add this:
bool validate_spec_fun( char *name );
Should fix ya right up....
Abadon
       
Post is unread #10 Jun 13, 2003, 4:43 pm
Go to the top of the page
Go to the bottom of the page

Zhamel

GroupMembers
Posts68
JoinedApr 5, 2005

That worked just fine. Thanks.

Can this solution be used to clear up other implicit declaration? Or would they require another method?
       
Post is unread #11 Jun 16, 2003, 7:12 am   Last edited Aug 24, 2010, 7:05 pm by Samson
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

That depends on the situation.

First understand how this works

If the function is in another file or is after the point in a file where it is used, you need to declare the 'prototype' for it at the top so the compiler knows what to expect.

For instance, in the same code file you have:

void do_something( CHAR_DATA *ch )
{
   some_function(ch);
   return;
}

void some_function( CHAR_DATA *ch)
{
   send_to_char( "Hello!\n\r", ch );
   return;
}


The compiler will give you that error since 'some_function' is actually 'defined' after it's been used. Now, if before the 'do_something' command you had:
void some_function( CHAR_DATA *ch );

This gives a 'heads-up' to the compiler about the function. You're telling it 'It'll be there, don't worry!' and also telling it what arguments to expect.

The same goes for functions in other code files. Now I'm not sure if the order of processing is taken into account, meaning if some_function() was declared in a file compiled before this one, if it'd still error out... I believe it would since it's in a different file.

So in essence, if you know the function is in your code somewhere, and that the file it is in is being passed to the compiler (check your Makefile!), then yes - declaring a prototype should fix it. Otherwise, you need to write the function. ;)

-- X
       
Pages:<< prev 1 next >>