Mike, has there been any progress on this issue?

It should just be a missing call to filesystem->UnloadModule.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Durand
Sent: Saturday, April 28, 2007 5:10 PM
To: hlcoders@list.valvesoftware.com
Subject: RE: [hlcoders] plugin_unload woes

I'll look into this question for you, Tony.

-Mike Durand
 Valve

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tony Paloma
Sent: Saturday, April 28, 2007 12:43 PM
To: hlcoders@list.valvesoftware.com
Subject: RE: [hlcoders] plugin_unload woes

It's not that difficult. I just want to know if there is a reason that
plugins aren't removed from memory after plugin_unload "unloads" them.
If there is, then OK that's fine. If there isn't, then I was hoping that
it could be added in. I wouldn't expect anybody on the list except a
Valve developer to know the answer. I was just hoping someone from Valve
would respond.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Spencer
'voogru'
MacDonald
Sent: Friday, April 27, 2007 4:48 PM
To: hlcoders@list.valvesoftware.com
Subject: RE: [hlcoders] plugin_unload woes

It's a hard question.

Every time I ask a hard question the list goes quiet.

:(

- voogru.

-----Original Message-----
From: Tony Paloma [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 5:27 PM
To: hlcoders@list.valvesoftware.com
Subject: RE: [hlcoders] plugin_unload woes

Is there anyone at Valve on this list that knows more about plugin
unloading? I'd like to know if there is a reason that the module is not
unloaded from memory when plugin_unload unloads a plugin.

Thanks,
Tony Paloma

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tony Paloma
Sent: Saturday, April 21, 2007 11:17 AM
To: hlcoders@list.valvesoftware.com
Subject: [hlcoders] plugin_unload woes

This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ] This has been brought
up before, even as early as 2005, but no discussion really ever took
place about it. When a plugin is unloaded with plugin_unload, it's
destructor is never called and it is never actually unloaded from
memory. This makes it impossible to update plugins without having to
restart the server.



I've experimented with this, and I believe all that needs to happen is
that after the engine calls the plugin's Unload function, it just needs
to call
filesystem->UnloadModule(plugin). I came up with this based on the fact
filesystem->that
if I call it myself in the plugin's Unload function, it successfully
calls the destructor and unloads from memory. However, it immediately
crashes because it tries to return to the where it left off in the
plugin's Unload function which is now invalid memory (see example at
end).



Furthermore, if you try to get around this by renaming the plugin's DLL
after it is "unloaded" and then replacing the DLL with a new one, it
just loads the old one. The only way to get around it is to load a
completely new DLL (e.g. plugin_2.dll).



My plugin fully supports being unloaded and loaded in the middle of a
game, but this is the only thing stopping that feature from being
useful. Maybe there is a reason it is not unloaded after the
plugin_unload command, or maybe it's just a mistake. Could Valve please
respond?





Example from second paragraph:





IFileSystem *filesystem = NULL;

CSysModule *g_OurDLL = NULL;





bool CEmptyServerPlugin::Load(               CreateInterfaceFn
interfaceFactory, CreateInterfaceFn gameServerFactory )

{

                filesystem =
(IFileSystem*)interfaceFactory(FILESYSTEM_INTERFACE_VERSION, NULL);

g_OurDLL = filesystem->LoadModule( "sourceop" ); // get the handle for
our dll to unload later

                return true;

}



void CEmptyServerPlugin::Unload( void )

{

                filesystem->UnloadModule(g_OurDLL); // unload once
because we loaded it ourself (decrements engine's use counter)

                filesystem->UnloadModule(g_OurDLL); // unload again to
actually unload dll

                // crash here (invalid memory access)

}

--


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to