[Lazarus] Porting Delphi (2007/XE5) application, how to handle ADODB?

Bo Berglund bo.berglund at gmail.com
Sat Feb 11 21:01:49 CET 2023

On Sat, 11 Feb 2023 16:31:56 +0100, Martin Frb via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>On 11/02/2023 12:23, Bo Berglund via lazarus wrote:
>> Then rebuilt and tried to run, but I get an immediate fatal exception!
>> This happens both when starting within Lazarus and from the exe file itself.
>> Message:
>>   --------------------------------------------------------
>>   | Project AppManager raised exception class 'External: |
>>   | ACCESS VIOLATION' with message:                      |
>>   | Access violation reading from address                |
>>   | $0000000000000040                                    |
>>   |                                                      |
>>   | At adress 1000096AD                          [OK]    |
>>   --------------------------------------------------------
>> How can I find the cause of this exception?
>Did the debugger jump to any source code?
>What does the "Callstack" window show?
>If neither shows anything, the error might be in the RTL or kernel. What 
>does the assembler win show?
>Give the data from the error message, I guess there is a nil pointer 
>deref (e.g. access to a field in an object that is nil)

When I wrote my last post I had problems finding a location to put a breakpoint
so I could step through the code.

But later I found by trial-and-error where the exception was coming from in
general. And where I could put a breakpoint to start stepping from.

It is from a logging component I have used on Delphi since more than 20 years.
When it starts its logging it is supposed to read the application version info
and write a start entry to today's log including the application version etc.

When I moved some applications from Delohi on Windows to Lazarus on Linux I had
to make a clone of the logging component where a lot of dependencies on external
components for reading version etc was removed and instead the Lazarus/fpc
handling was taken into account. Then it has worked fine on Lazarus at least on

When porting the current application I changed the Class name for the logging
component correspondingly and hoped it would be enough, but unfortunately it is
not. I don't know where I should fix it yet and I don't have time to do it now
when I am busy just porting the handler application.

So for now I commented out all calls to the logger creation (where the exception
happened) and its use so I can move on.

This has brought me to the verification that now the ported app is actually
working regarding access to the MSSQL database! :-)
The DB conmnection is needed in order to start up the app at all, without a
database verified login it just shuts down. But it IS working with the
MSSQLSERVER just fine so far.

But I have another problem I will describe in a new thread...

Bo Berglund
Developer in Sweden

More information about the lazarus mailing list