I've written a Delphi DLL that communicates with a third party program via COM. Some users report that the third party program crashes occasionally. Others using the software in an identical fashion have never experienced a crash. When this crash occurs, the third party program appears to simply become unavailable in my DLL app.
The vendor swears that it is a problem with how the Delphi DLL is coded, although they have not seen the source code and can't tell what what the DLL is doing to cause the crash, but they know it's "something".
Aside from the fact that I believe that the third party program shouldn't be crashing due to some minuscule problem in my DLL, let's assume that there is something in my DLL that needs fixing.
How can I determine how my app might be causing this? Does anyone have experience communicating via COM with a hyper-sensitive program like this? Are there some common things to look for that might be crashing the third party program?
Here's how it could look...
Loaded DLL
Started MyFunction1 with parameters: 1,4,hello
1
2
...
500
Ended MyFunction1
to make that,,, I'd setup a few functions (in their own unit):
// opens a text file (fixed name), and appends to it.
function InitializeLog;
// closes the file
function CloseLog;
//add a log line.
function Log(message:string='', startNewFunction:boolean:False);
you would call it like this:
function MyFunction1(Integer,Integer,String);
begin
try
Log('Loaded DLL');
//use inttostr and do some string concats to get the params
Log('Started MyFunction1 with parameters: 1,4,hello',true);
//Then every other line:
Log;
//this would increment a global variable FuncLine:Integer
//and write it to the file.
except
On E:Exception (Log('***'+E.Message));
end;
end;
Something like this should have a {$DEFINE} to enable these logging functions, to enable/disable the diagnostic logging.
This could also be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With