From: robin.boerdijk at nl.origin-it.com (Robin Boerdijk)
Date: Wed, 26 May 1999 20:06:53 +0200
Subject: Module initialization problem when using COM
References: <0E16861EE7BCD111BE9400805FE6841F0949A5B2@c1s5x001.cor.srvfarm.origin-it.com><7i4sgb$3c5$1@m2.c2.telstra-mm.net.au><0E16861EE7BCD111BE9400805FE6841F09581422@c1s5x001.cor.srvfarm.origin-it.com><37495899.62DA32ED@appliedbiometrics.com><7icobr$9o$1@m2.c2.telstra-mm.net.au><0E16861EE7BCD111BE9400805FE6841F095B82D4@c1s5x001.cor.srvfarm.origin-it.com><7ifioj$rhi$1@m2.c2.telstra-mm.net.au> <hR9ZnGAiR8S3EwQ0@jessikat.demon.co.uk>
Message-ID: <0E16861EE7BCD111BE9400805FE6841F09626536@c1s5x001.cor.srvfarm.origin-it.com>
Content-Length: 2356
X-UID: 1764                                                

I tried Marks suggestion and it behaves as expected: the initialization
function is called multiple times within the same DLL instance. Apperently,
Robin was right all along. Sorry it took so long for me to catch up, I had
to climb the DLL learning curve first.

My conclusion is that we need to do the following:

1. Record somewhere that module initialization functions should be
re-executable. Currently, the Python documentation only states: "When the
Python program imports module spam for the first time, initspam() is
called." This is what made me believe that an initialization function could
never be called more than once. I don't know what the correct place for this
is, the FAQ or the Python documentation itself.

2. I'll ask the ILU guys to make their initialization function re-executable
(as suggested by Robin in the first place).

Thanks for your help everyone,

Robin Boerdijk

Robin Becker <robin at jessikat.demon.co.uk> wrote in message
news:hR9ZnGAiR8S3EwQ0 at jessikat.demon.co.uk...
> In article <7ifioj$rhi$1 at m2.c2.telstra-mm.net.au>, Mark Hammond
> <MHammond at skippinet.com.au> writes
> >Robin Boerdijk wrote in message
> >
> >>But you would also expect the .dll of the extension module to be
unloaded
> >>and reloaded so that the state of the .dll is cleared. As Christian
> >>suggests, the .dll somehow doesn't  get unloaded and reloaded an I
wonder
> >if
> >
> ... probably good stuff :)
> >IMO, the _real_ issue is that Python (and/or its modules) are not capable
of
> >being reinitialized without the DLL being "physically" unloaded, and it
> >should be.  It is unclear to me if anything other than ILU is seriously
> >upset that this happens.
> >
> >So the real question is: "yes, this happens, and for good reason.  Who is
it
> >a problem for and why?"
> >
> >[Other than PythonCOM itself probably - this may well cause some leaks in
> >the PythonCOM module init function - which brings me back to a different
> >issue - how does a module know it is being cleaned up by Python?
> >Aaarrrggg... :-]
> >
> yep we discussed this before; I asked then if modules couldn't have
> special named functions apart from __init__ ie __del__ etc. I tried a
> couple of times to use the deletion of globals to check when a module
> was being cleaned up, but it wasn't real reliable.
> >Mark.
> >
> >
>
> --
> Robin Becker










