api call routines

  • Thread starter Thread starter Bill Lunney
  • Start date Start date
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
 
Hi there

I am using third party DLL files to link my spreadsheets to a cash register
to download sales files.
The system works fine except that my spreadsheets crash quite often. It
seems that it is loading the DLL files into memory but it is not releasing
it from memory when it has finished.

Is there a command I can use to free the DLL file from memory.

Thank you

Anthony
 
Back
Top