<!-- 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-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> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00582.html">Previous</a> | <a href="msg00584.html">Next</a> ] Thread: [ <a href="msg00592.html">Previous</a> | <a href="msg00580.html">Next</a> ] Index: [ <A HREF="author.html#00583">Author</A> | <A HREF="#00583">Date</A> | <A HREF="thread.html#00583">Thread</A> ] <!--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 <<A HREF="mailto:d97elm#dtek,chalmers.se">d97elm#dtek,chalmers.se</A>></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: > Niklas Elmqvist wrote: > > If you are wondering what the fuss is all about (or why this posting is > > getting so long), let me just say this: One application of this could be > > an Event class (in an event-driven system), whose base class is known to > > the core server (allowing for it to check the priority and expiration of > > the event, among other things), while the modules can inherit from the > > base class and redefine it to suit their particular needs. I also plan on > > using this technique for Handler objects which take care of things such as > > socket I/O, parsing, DB managment, etc, and the good thing about it is > > that I thus will be able to attach and detach the modules at run-time (to > > remedy a bug, for example). If the base classes are correctly implemented, > > the core will never even have to be recompiled and thus never rebooted > > (not accounting for fatal bugs, that is <g>)! > > Not quite so. > > See, I use almost exactly the same technique in my Java development, > and indeed, it's possible, using Class.forName( ... ), instantiate the > absolutely unknown before classes - in fact, I suspect that the other > guy, who lives at <A HREF="http://www.wwwalker.com/">http://www.wwwalker.com/</A>, used this technique to > produce applets at least a year ago, but his technique seems to be even > more pervert - he compiles classes on-demand, and then actually loads > them. That'd be really useful in some contexts, but not, I believe, in my MUD server :) > The weak point for me is that once you load the class, it's extremely > difficult to UNLOAD it. > I've heard that the guys who write the servlet support for Apache > managed to write the custom ClassLoader to do that, but didn't have time > 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 > 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><Possible follow-up(s)><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> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>