Recent

Author Topic: I get access violation when running my project in windows xp  (Read 863 times)

Froxter

  • New Member
  • *
  • Posts: 13
I get access violation when running my project in windows xp
« on: April 25, 2025, 12:12:24 pm »
My project is setted to run in 32bit but each time I try execute it in windows XP i get an access violation in main.pas (but i give the other codes another causes the problem) the weird thing is that running it in windows 7 and above there are not errors. I know I can just say that you need at least windows 7 to run it but I really need this thing executes in windows xp. Thank you

Thaddy

  • Hero Member
  • *****
  • Posts: 16945
  • Ceterum censeo Trump esse delendam
Re: I get access violation when running my project in windows xp
« Reply #1 on: April 25, 2025, 02:36:53 pm »
The only easy way to get around this, is using an older version of Lazarus.
The problem is that the Syn controls and other code use Windows api calls that are only available from Windows Vista and higher, not XP. E.g. High DPI.
I guess nobody wants to fix that for a legacy platform.
Older versions are still avalable, but do not expect newer features will work.
« Last Edit: April 25, 2025, 02:39:45 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11164
  • Debugger - SynEdit - and more
    • wiki
Re: I get access violation when running my project in windows xp
« Reply #2 on: April 25, 2025, 02:41:23 pm »
The only easy way to get around this, is using an older version of Lazarus.
The problem is that the Syn controls and other code use Windows api calls that are only available from Windows Vista and higher, not XP. E.g. High DPI.
I guess nobody wants to fix that for a legacy platform.
Older versions are still avalable, but do not expect newer features will work.

If that "Syn" is about SynEdit, then which calls are that? They should be kept compatible. And afaik they run on XP inside the IDE.

Thaddy

  • Hero Member
  • *****
  • Posts: 16945
  • Ceterum censeo Trump esse delendam
Re: I get access violation when running my project in windows xp
« Reply #3 on: April 25, 2025, 02:57:01 pm »
There seem to be calls that are only Vista and higher. If a program used to work with lower versions, then that is the case.
It is not his code, but somewhere in the libraries he uses.
I am not prepared to debug those.
« Last Edit: April 25, 2025, 02:59:03 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

440bx

  • Hero Member
  • *****
  • Posts: 5294
Re: I get access violation when running my project in windows xp
« Reply #4 on: April 25, 2025, 03:08:00 pm »
@Froxter,

post a screenshot of the access violation, that information could be helpful in solving the problem.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Froxter

  • New Member
  • *
  • Posts: 13
Re: I get access violation when running my project in windows xp
« Reply #5 on: April 25, 2025, 03:47:37 pm »
@Froxter,

post a screenshot of the access violation, that information could be helpful in solving the problem.
Compiling in XP i get this

Bart

  • Hero Member
  • *****
  • Posts: 5563
    • Bart en Mariska's Webstek
Re: I get access violation when running my project in windows xp
« Reply #6 on: April 25, 2025, 03:59:41 pm »
Build your project with full debug and line info (-Criot -gl -gh -gw2).
Include the units LazLogger, and LCLExceptionStacktrace in your program.
Start the program with --debug-log=path\to\logfile
Let the program crash
Attach the log file here.

Alternatively run the program in gdb, let it crash and get a backtrace.

Bart

Froxter

  • New Member
  • *
  • Posts: 13
Re: I get access violation when running my project in windows xp
« Reply #7 on: April 25, 2025, 04:13:39 pm »
Build your project with full debug and line info (-Criot -gl -gh -gw2).
Include the units LazLogger, and LCLExceptionStacktrace in your program.
Start the program with --debug-log=path\to\logfile
Let the program crash
Attach the log file here.

Alternatively run the program in gdb, let it crash and get a backtrace.

Bart
I wasnt able to find the "-Criot" and make the log file
« Last Edit: April 25, 2025, 04:15:39 pm by Froxter »

440bx

  • Hero Member
  • *****
  • Posts: 5294
Re: I get access violation when running my project in windows xp
« Reply #8 on: April 25, 2025, 04:48:43 pm »
You're running the program from Lazarus.  In Lazarus, set the debugging options to "Dwarf with sets" or some of the other dwarf options if you prefer a different one.

Run the program from Lazarus, when the access violation occurs, there should be a box that gives you information about where the access violation took place.  Take a screenshot of that box and post it here.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Froxter

  • New Member
  • *
  • Posts: 13
Re: I get access violation when running my project in windows xp
« Reply #9 on: April 25, 2025, 06:12:20 pm »
You're running the program from Lazarus.  In Lazarus, set the debugging options to "Dwarf with sets" or some of the other dwarf options if you prefer a different one.

Run the program from Lazarus, when the access violation occurs, there should be a box that gives you information about where the access violation took place.  Take a screenshot of that box and post it here.

also in Application.CreateForm(TfrmMain, frmMain); i get:
Application = <Error: Identifier not found: "Application" at start of expression>

 
var
 Application: TApplication =
class
(TCustomApplication)

C:\lazarus\lcl\forms.pp(1988,3)

Description

The TApplication singleton.

Application
 is a unit global variable with the
TApplication
 instance representing the currently executing application. The value for the variable is assigned in the initialization section for the unit when the application is started. It is freed in the finalization section when the application is terminated.

Use the
TApplicationProperties
 component to provide design-time configuration settings for properties (including event handlers) which are automatically applied to Application at run-time.


oohh and also in Lazarus when i execute it in xp and going to the main form in the form editor the program crashes showing error of Access Violation
« Last Edit: April 25, 2025, 06:19:36 pm by Froxter »

Froxter

  • New Member
  • *
  • Posts: 13
Re: I get access violation when running my project in windows xp
« Reply #10 on: April 25, 2025, 06:23:55 pm »
...

440bx

  • Hero Member
  • *****
  • Posts: 5294
Re: I get access violation when running my project in windows xp
« Reply #11 on: April 25, 2025, 06:26:28 pm »
The first question is: if the program doesn't compile (<Error: Identifier not found: "Application" at start of expression>) how do you get it to run ?

did you make some change that allowed it to compile and run ? and if the answer is "yes", what was that change ?

Also, the messagebox says there is a nil pointer someplace in your program.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

Froxter

  • New Member
  • *
  • Posts: 13
Re: I get access violation when running my project in windows xp
« Reply #12 on: April 25, 2025, 06:31:16 pm »
The first question is: if the program doesn't compile (<Error: Identifier not found: "Application" at start of expression>) how do you get it to run ?

did you make some change that allowed it to compile and run ? and if the answer is "yes", what was that change ?

Also, the messagebox says there is a nil pointer someplace in your program.
It compiles but doesnt run and maybe is one of my elements of the main form. there are panels, a toolbar, toolbar buttons, a menu, an action list, an image list, a shell tree view, 2 splitters, a lisht shell view and a page control. tab sheets and synedits are added by code

Froxter

  • New Member
  • *
  • Posts: 13
Re: I get access violation when running my project in windows xp
« Reply #13 on: April 25, 2025, 07:00:06 pm »
Update: Deleting the TShellTreeView it finally runs in XP! Im gonna try to replace the file explorer creating a new one. Thanks for the help and sorry a lot for all the inconvenience caused

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11164
  • Debugger - SynEdit - and more
    • wiki
Re: I get access violation when running my project in windows xp
« Reply #14 on: April 25, 2025, 07:47:57 pm »
Indeed, I can confirm. Even dropping a TShellTreeview onto a form gives the error (Laz 4.99). That should be reported. It should still work.

 

TinyPortal © 2005-2018