Recent

Author Topic: [SOLVED] How can I track down the error if the program doesn't even start?  (Read 482 times)

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
I am adapting my game sources to the new SDL3 library (I wrote the SDL3 headers myself, all functions are loaded automatically, so LoadLibrary etc. are not used). Most of it is done, but I have an unusual problem that I don't know how to solve.

When I run the program from the IDE, in debugging mode (of course debug symbols are generated), the only thing that appears on the screen is an error window (see the attachment). The debugger doesn't start, so I can't even check what is causing the error.

Does anyone know how to track down the error in such a situation?
« Last Edit: October 14, 2024, 01:30:37 pm by furious programming »
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: How can I track down the error if the program doesn't even start?
« Reply #1 on: October 13, 2024, 09:05:13 pm »
Okay, I know what the problem is. If I run the project from the IDE, I only get a window with an error number (or address). The problem was that the program did not find the procedure entry point in the .dll and this can only be found out by running the exe directly from the disk, outside the IDE.

It's a pity that the IDE does not inform that the procedure entry point in the DLL was not found, but instead displays a window with a worthless and meaningless error code/address.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8000
Re: How can I track down the error if the program doesn't even start?
« Reply #2 on: October 13, 2024, 09:51:53 pm »
Do we see a bug report arising out of this?

It's a pity that the IDE does not inform that the procedure entry point in the DLL was not found, but instead displays a window with a worthless and meaningless error code/address.

I've not been a serious Windows user for 20 years or so, but I almost commented earlier that that looked like a Windows error number which you should find documented in the SDK: so it's anything but worthless or meaningless.

If it's a missing DLL entry point and you're relying on the OS to resolve it, then control was never transferred into your program. So arguably, the IDE could have said "The kernel gave me this error code when I told it to run the program..." which I suspect is what the first nibble would translate to.

So: do we see a bug report and patch arising out of this ? >:-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

440bx

  • Hero Member
  • *****
  • Posts: 4727
Re: How can I track down the error if the program doesn't even start?
« Reply #3 on: October 13, 2024, 10:34:55 pm »
It's a pity that the IDE does not inform that the procedure entry point in the DLL was not found, but instead displays a window with a worthless and meaningless error code/address.
The error is from the Windows loader and, IIRC, there are some instances where the loader does _not_ report which dll caused the problem.

Anyway, you should get the same error running the program from Explorer or the CLI which makes it quite easy to find out what applies in your particular case.

ETA:

You may find the information in the following thread useful:
https://forum.lazarus.freepascal.org/index.php/topic,55189.msg410196.html#msg410196

HTH.

« Last Edit: October 13, 2024, 11:28:16 pm by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
Re: How can I track down the error if the program doesn't even start?
« Reply #4 on: October 14, 2024, 01:30:16 pm »
Ok, thanks for the clarification — I didn't know this was controlled by the OS.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

Thaddy

  • Hero Member
  • *****
  • Posts: 16139
  • Censorship about opinions does not belong here.
If I smell bad code it usually is bad code and that includes my own code.

flowCRANE

  • Hero Member
  • *****
  • Posts: 883
No, the error concerned the SDL2.dll, required by the SDL2_image.dll — both are coded in pure C.
Lazarus 3.4 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on a retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL.

 

TinyPortal © 2005-2018