Author Topic: COFF Magic Error  (Read 3992 times)

kiko_of_davao

  • Newbie
  • Posts: 1
COFF Magic Error
« on: April 27, 2019, 11:51:51 am »
I am new to Lazarus. I wish to use it to enable existing Turbo Pascal (Ver 7.0) .EXE files to run under Windows 10.  My .PAS source file contains  the link directive {$L  VGADRV.OBJ}.   This .OBJ file is in the same directory as the .PAS file.  When I attempt to compile this in Lazarus IDE v2.02 I get the Error message:

          "Error: Illegal COFF Magic while reading C:\Lazarus\Play_Pen\VGADRV.OBJ

What work-around can I use to enable compilation?  Thank you for your insights

Thaddy

  • Hero Member
  • *****
  • Posts: 19978
  • Pointless static linking author
Re: COFF Magic Error
« Reply #1 on: April 27, 2019, 12:20:13 pm »
COFF is not OMF. TP mode doesn't understand that binary format. And that is correct!
Any "programmer" that knows only one programming language is not a programmer

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: COFF Magic Error
« Reply #2 on: April 27, 2019, 12:32:03 pm »
What work-around can I use to enable compilation?  Thank you for your insights

Try objconv.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 13053
  • FPC developer.
Re: COFF Magic Error
« Reply #3 on: April 27, 2019, 12:51:26 pm »
Where does the obj come from? If it is from TP, it won't work as TP is 16-bit and FPC (generally) 32 or 64-bit.

440bx

  • Hero Member
  • *****
  • Posts: 6628
Re: COFF Magic Error
« Reply #4 on: April 27, 2019, 01:49:54 pm »
Try objconv.
Very nice stuff there.  Thank you for mentioning it.

Now, I'm really wondering how I never "bumped" into that site before. 
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Cecolord

  • New Member
  • *
  • Posts: 10
Re: COFF Magic Error
« Reply #5 on: November 04, 2026, 02:04:03 pm »
I got same error/s COFF-MagicError.
Because I restart my Win8x32, I fix same problems in my sources,
i got skip or avoid "COFF-Magic"
My Windows is Win8, target, Win8x32.
Please I only, i update this topic.
Temporally , only I fixed my..
 8)

Code: [Select]
lazaisoc.lpr(96,1) Error: Illegal COFF Magic while reading C:\lazarus\components\lazutils\lib\i386-win32\lazutilsstrconsts.o
lazaisoc.lpr(96,1) Error: Illegal COFF Magic while reading C:\lazarus\components\lazutils\lib\i386-win32\masks.o
lazaisoc.lpr(96,1) Error: Error reading COFF string table while reading C:\lazarus\components\lazutils\lib\i386-win32\lazlistclasses.o
lazaisoc.lpr(96,1) Error: Illegal COFF Magic while reading C:\lazarus\components\lazutils\lib\i386-win32\lazlogger.o

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 13053
  • FPC developer.
Re: COFF Magic Error
« Reply #6 on: November 04, 2026, 02:48:27 pm »
Sounds like those files have become corrupt, or there is some mixup between win32 and win64 files. Try to clean and rebuild the LCL?

 

TinyPortal © 2005-2018