B
Bill Lunney
So when you say you're using DLL's I'm assuming you have something like
Public Function Declare ......
instead of instatiation of a COM object with
CreateObject etc.
That being the case....
The problem with DLL's is they execute 'in proces's. This means the DLL is
brought into the memory space occupied by the Excel process and anything
which goes wrong within the DLL will cause the whole process (Excel
included) to crash & burn. Ok that's the theory of DLL's over, this is just
an explanation of why it's bringing down Excel incase you didn't know.
There's not a lot you can do when calling a DLL. It's a black box and
resource allocation/cleanup etc. will all be handled by it.
I would invest some time in nailing down what circumstances causes the crash
then try to have a think about a workaround. I'd also check to see if there
are any initialisation procedures etc. you have to call prior to execution
of the function.
This is more advanced but another way would be to wrap the call to the DLL
within a COM object itself. A kind of broker object. This would be a COM
exe. That way if the DLL itself crashed it's only going to bring down the
broker and as you instantiate a new one for each call Excel will just carry
on as normal. This would be my choice.
--
Regards,
Bill Lunney
www.billlunney.com
Public Function Declare ......
instead of instatiation of a COM object with
CreateObject etc.
That being the case....
The problem with DLL's is they execute 'in proces's. This means the DLL is
brought into the memory space occupied by the Excel process and anything
which goes wrong within the DLL will cause the whole process (Excel
included) to crash & burn. Ok that's the theory of DLL's over, this is just
an explanation of why it's bringing down Excel incase you didn't know.
There's not a lot you can do when calling a DLL. It's a black box and
resource allocation/cleanup etc. will all be handled by it.
I would invest some time in nailing down what circumstances causes the crash
then try to have a think about a workaround. I'd also check to see if there
are any initialisation procedures etc. you have to call prior to execution
of the function.
This is more advanced but another way would be to wrap the call to the DLL
within a COM object itself. A kind of broker object. This would be a COM
exe. That way if the DLL itself crashed it's only going to bring down the
broker and as you instantiate a new one for each call Excel will just carry
on as normal. This would be my choice.
--
Regards,
Bill Lunney
www.billlunney.com