Dynamically reloading extension modules

Tonetheman tonetheman at hotmail.com
Thu Mar 22 00:21:32 EST 2001


It looks like you should be able to do this.

You should change the file dynload_win.c to look more like the
dynload_beos.c Whoever wrote that module saved the HMODULE (or whatever it
is called in Beos) in a dictionary. Then you can FreeLibrary when you get
unloaded...

Just an idea...


"Ken Seehof" <kens at sightreader.com> wrote in message
news:mailman.985218751.8244.python-list at python.org...
>
> > On Wed, Mar 21, 2001 at 03:36:15PM -0800, Ken Seehof wrote:
> > > Not exactly.  I didn't state the problem very clearly.  The
> > > problem is that while an extension module is loaded, the
> > > module file (pyd on windows) is read-only.
> > >
> > > At least this is true on windows.  On unix, I think maybe you
> > > can rename the module file, rebuild it, and do a reload(module).
> > > Is this true?  Windows doesn't allow you to rename or rewrite
> > > a dll while it is in use, so something like FreeLibrary would be
> > > necessary.
> >
> > Sorry, I can't answer Windows questions. I haven't had to run
> > Windows in years.
> >
> > But I would still think that reload() should work as long as
> > you are using python modules, *not* c/c++ modules.
>
> I -am- talking about c/c++ modules (which I have been referring
> to as "extension" modules).  Hence there's a bit more to it than
> reload().
>
> I want to recompile and reload a c/c++ extension module from
> within a continuously running python program.
>
> > Beazley has no disclaimers about reload working only on
> > specific platforms.
> >
> > There is a caveat, objects created with the old module won't be
> > updated.
>
>
>





More information about the Python-list mailing list