Re: [code] dl* functions

From: Eric Green (
Date: 03/01/97

>	One of the things I've been thinking of/tinkering with is to have the
>MUD dynamically add functions while running using the dl* set of functions.
>	I have a few questions about this:
>	1) How portable is the dl* set of calls around Unicies?  I know Linux
>	and (I think) Solaris have them, but what about some others (AIX,
>	IRIX, BSD+clones, etc.)

>From looking at NetBSD 1.2, it appears that it has support for the dynamic
linking loader.  If NetBSD has support, then it is likely some of the other
BSD flavors also have it.

>	2) Is it easy to *replace* current functions, or what should I watch
>	out for (Say, as the mud is running, completely replace the fight()
>	finction with something else that takes the same parameters...)

You are apt to have problems reloading functions which depend on static
variables, since the variables are likely to be reset when the function is

The easiest functions to replace are ones referenced by pointers, such as
commands, special procedures, and spells.

>	3) Am I nuts in even thinking about this? :)

There were a couple of posts on the moderated circle list on doing this.
You can check out them in the archive at

>Also, is there a (better) way to map pointer names to functions (for those
>use the event code on the Circle ftp site will hopefully know what I'm talking
>about)?  Since that code stores function pointers, I would like a simple stat
>command to show what function will get called at what time, yet hex addresses
>aren't exactly human readable. :)  My current solution is to take nm output
>from the compiled executable, and then load it up as a text file, and the stat
>command go down the list, finds a "mathcing" pointer, then display the name.
>Is there an "easier" way (since it requires some gymnastics at build time...)

An easy way to get the function name would be to add a char pointer to the
event struct, which points to a const char * of the function's name.


| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |
|    Or send 'info circle' to     |

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