1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Dynamic Loading of Modules -->
<!--X-From-R13: @vxynf Syzdivfg <q97ryzNqgrx.punyzref.fr> -->
<!--X-Date: Wed, 25 Feb 1998 06:26:41 +0000 -->
<!--X-Message-Id: Pine.SOL.3.96.980225071049.26694A&#45;100000#licia,dtek.chalmers.se -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Dynamic Loading of Modules</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:d97elm#dtek,chalmers.se">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00582.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00584.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00592.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00580.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00583">Author</A>
&nbsp;|&nbsp;<A HREF="#00583">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00583">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Dynamic Loading of Modules</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Dynamic Loading of Modules</LI>
<LI><em>From</em>: Niklas Elmqvist &lt;<A HREF="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</A>&gt;</LI>
<LI><em>Date</em>: Wed, 25 Feb 1998 07:26:37 +0100 (MET)</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>

On Tue, 24 Feb 1998, Vadim Tkachenko wrote:
&gt; Niklas Elmqvist wrote:
&gt; &gt; If you are wondering what the fuss is all about (or why this posting is
&gt; &gt; getting so long), let me just say this: One application of this could be
&gt; &gt; an Event class (in an event-driven system), whose base class is known to
&gt; &gt; the core server (allowing for it to check the priority and expiration of
&gt; &gt; the event, among other things), while the modules can inherit from the
&gt; &gt; base class and redefine it to suit their particular needs. I also plan on
&gt; &gt; using this technique for Handler objects which take care of things such as
&gt; &gt; socket I/O, parsing, DB managment, etc, and the good thing about it is
&gt; &gt; that I thus will be able to attach and detach the modules at run-time (to
&gt; &gt; remedy a bug, for example). If the base classes are correctly implemented,
&gt; &gt; the core will never even have to be recompiled and thus never rebooted
&gt; &gt; (not accounting for fatal bugs, that is &lt;g&gt;)!
&gt; 
&gt; Not quite so. 
&gt; 
&gt; See,  I use almost exactly the same technique in my Java development,
&gt; and indeed, it's possible, using Class.forName( ... ), instantiate the
&gt; absolutely unknown before classes - in fact, I suspect that the other
&gt; guy, who lives at <A  HREF="http://www.wwwalker.com/">http://www.wwwalker.com/</A>, used this technique to
&gt; produce applets at least a year ago, but his technique seems to be even
&gt; more pervert - he compiles classes on-demand, and then actually loads
&gt; them.

That'd be really useful in some contexts, but not, I believe, in my MUD
server :)

&gt; The weak point for me is that once you load the class, it's extremely
&gt; difficult to UNLOAD it. 
&gt; I've heard that the guys who write the servlet support for Apache
&gt; managed to write the custom ClassLoader to do that, but didn't have time
&gt; to dig it myself.

The web server Apache, I presume? Never toyed around with this, but on a
side note I would like to add that the module system of Apache, although
useful and stable, could be done *much* better. The mods are linked to
the main binary at link-time, so you still have to recompile and reboot to
incorporate new mods. Of course, since a web server 

&gt; How do you handle this?

Fortunately, as I am developing my server in C++ on a Linux system, I have
access to the dynamic loading package (originally derived from Solaris, I
believe). To dynamically load a shared binary I simply do a dlopen(), to
retrieve a symbol (such as a function pointer) from the lib I do dlsym(),
and to unload the entire lib I do a dlclose(). Check out the manpages for
these functions to get an in-depth description.

However, since I have preciously little experience with Java, I cannot
help you in that matter.

-- Niklas Elmqvist (d97elm#dtek,chalmers.se) ----------------------
"You can't trample infidels when you're a tortoise. I mean, all you 
 could do is give them a meaningful look."	 
	- Terry Pratchett, Small Gods


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00582.html">Re: [MUD-Dev] The MLI Project</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00584.html">Re: [MUD-Dev] The MLI Project</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00592.html">bar-time (was Re: [MUD-Dev] The MLI Project)</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00580.html">Re: [MUD-Dev] The MLI Project</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00583"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00583"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><strong><A NAME="00609" HREF="msg00609.html">Tutorial: Let's build a Compiler! - Part I: Introduction</A></strong>, 
Jon A. Lambert <a href="mailto:Jon.A.Lambert#ix,netcom.com">Jon.A.Lambert#ix,netcom.com</a>, Fri 27 Feb 1998, 03:36 GMT
<LI><strong><A NAME="00608" HREF="msg00608.html">Tutorial: Comments on Hand-crafting a compiler</A></strong>, 
Jon A. Lambert <a href="mailto:Jon.A.Lambert#ix,netcom.com">Jon.A.Lambert#ix,netcom.com</a>, Fri 27 Feb 1998, 03:30 GMT
<LI><strong><A NAME="00607" HREF="msg00607.html">Re: [MUD-Dev]  Java and Javascript</A></strong>, 
Mike Sellers <a href="mailto:mike#online-alchemy,com">mike#online-alchemy,com</a>, Thu 26 Feb 1998, 16:13 GMT
<LI><strong><A NAME="00592" HREF="msg00592.html">bar-time (was Re: [MUD-Dev] The MLI Project)</A></strong>, 
Mike Sellers <a href="mailto:mike#online-alchemy,com">mike#online-alchemy,com</a>, Wed 25 Feb 1998, 21:54 GMT
<LI><strong><A NAME="00583" HREF="msg00583.html">Dynamic Loading of Modules</A></strong>, 
Niklas Elmqvist <a href="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</a>, Wed 25 Feb 1998, 06:26 GMT
<LI><strong><A NAME="00580" HREF="msg00580.html">Re: [MUD-Dev] The MLI Project</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 24 Feb 1998, 18:20 GMT
<UL>
<LI><strong><A NAME="00582" HREF="msg00582.html">Re: [MUD-Dev] The MLI Project</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Tue 24 Feb 1998, 19:25 GMT
</LI>
</UL>
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00584" HREF="msg00584.html">Re: [MUD-Dev] The MLI Project</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 25 Feb 1998, 07:05 GMT
<UL>
<LI><strong><A NAME="00585" HREF="msg00585.html">Re: [MUD-Dev] The MLI Project</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Wed 25 Feb 1998, 08:09 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>