www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - RES file not linking anymore with DMD v2.052

reply "Ettienne Gilbert" <ettienne.gilbert gmail.com> writes:
Hi,

I've finally gotten round to upgrading my DMD to v2.062 (from 
v2.059) - running on Win XP.

I've had no issues recompiling the (quite old) DFL library I use 
with the latest DMD, so went on to rebuild a tool I previously 
developed (that uses DFL). Everything compiled ok, but the linker 
choked on my RES file. (This project build fine and worked 
perfectly on previous versions of DMD up to and including 
v2.059). The error is:

OPTLINK (R) for Win32  Release 8.00.12
Copyright (C) Digital Mars 1989-2010  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
atrchecker.RES(3) : Error 52: .DEF Syntax Error
DO

^	


I am sure that the "D0" and "^" is suppose to indicate the 
position of the error, but is pretty useless in this case.

I've googled on ".DEF Syntax Error" and, according to 
http://www.digitalmars.com/ctg/OptlinkErrorMessages.html, this 
indicates a "An invalid .def file syntax could not be parsed. ", 
which does not help much at all.

I am pretty confident though that it is not a DEF file issue 
since I am building a EXE (no DEF should be required). The Tool 
also builds fine if I remove the RES file from the project.

Googling on "Error 52" bought up nothing substantial either.

The RC file for the RES file is extremely simple:
Code:	

101 ICON DISCARDABLE ".\\Resources\\scope4.ico"

205 BITMAP DISCARDABLE ".\\Resources\\SomeBitmap.bmp"

STRINGTABLE DISCARDABLE
BEGIN
    3001 "....some string!....."
END	


I've tried compiling the RC file with both the MS as well as the 
DM resource compiler:

For DM:
rcc -32 atrchecker.rc

For MS:
"c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\rc" /r /v 
atrchecker.rc

The symptoms are exactly the same in both cases.

I can open the RES file with any number of resource editors 
(including Visual Studio and XN Resource Editor) and they all 
display the relevant BMPs and ICOs without errors.

Any ideas?

Regards,
Ettienne
Apr 22 2013
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 4/22/13, Ettienne Gilbert <ettienne.gilbert gmail.com> wrote:
 Any ideas?

Resource scripts can use one of two syntaxes - an older one and a new one, one uses BEG/END, the other { }, and Optlink only supports one of the two. I think you can use ResEdit[1] to convert the syntax so Optlink can understand it. [1] : http://www.resedit.net/
Apr 22 2013
prev sibling next sibling parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 22.04.2013 14:02, Ettienne Gilbert wrote:
 Hi,

 I've finally gotten round to upgrading my DMD to v2.062 (from v2.059) -
 running on Win XP.

 I've had no issues recompiling the (quite old) DFL library I use with
 the latest DMD, so went on to rebuild a tool I previously developed
 (that uses DFL). Everything compiled ok, but the linker choked on my RES
 file. (This project build fine and worked perfectly on previous versions
 of DMD up to and including v2.059). The error is:

 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 atrchecker.RES(3) : Error 52: .DEF Syntax Error
 DO

I suspect your build script has somehow omitted a ',' from the command line in its invocation of optlink. The usage is LINK obj[,out[,map[,lib[,def[,res]]]]] so if a comma misses, your resource file is interpreted as a def file. If you are invoking the linker through dmd, you might want to check the linker call by adding "-v" to the command line.
Apr 22 2013
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 22.04.2013 22:05, Ettienne wrote:
 I suppose this is then a Visual-D issue and not a DMD linker issue, right?

Yes, it should be fixed in the rc for the next version: http://www.dsource.org/projects/visuald/browser/downloads/VisualD-v0.3.36rc5.exe
Apr 22 2013
parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 23.04.2013 09:48, Ettienne wrote:
 On Monday, 22 April 2013 at 22:19:39 UTC, Rainer Schuetze wrote:
 Yes, it should be fixed in the rc for the next version:
 http://www.dsource.org/projects/visuald/browser/downloads/VisualD-v0.3.36rc5.exe

Hi Rainer, With VisualD-v0.3.36rc5 (Win XP 32bit, VS 2008) I get an install error: "Error loading C:\Program Files\VisualD\visuald.dll. Invalid access to memory location" I tried also with VisualD-v0.3.36rc4 - but get the same error. If I re-install VisualD-v0.3.35 it installs fine.

XP support for DLLs seems to have been broken between rc3 and rc4 ;-( I'll have to investigate... The fix for the command line is in rc1.
Apr 23 2013
prev sibling next sibling parent "Ettienne" <ettienne.gilbert gmail.com> writes:
On Monday, 22 April 2013 at 12:33:52 UTC, Andrej Mitrovic wrote:
 On 4/22/13, Ettienne Gilbert <ettienne.gilbert gmail.com> wrote:
 Any ideas?

Resource scripts can use one of two syntaxes - an older one and a new one, one uses BEG/END, the other { }, and Optlink only supports one of the two. I think you can use ResEdit[1] to convert the syntax so Optlink can understand it. [1] : http://www.resedit.net/

Hi Andrej, Thanks for the very speedy response. Handy to know about resedit as well, but it turned out that the problem was as Rainer Schuetze suspected. Regards, Ettienne
Apr 22 2013
prev sibling next sibling parent "Ettienne" <ettienne.gilbert gmail.com> writes:
On Monday, 22 April 2013 at 17:51:26 UTC, Rainer Schuetze wrote:
 On 22.04.2013 14:02, Ettienne Gilbert wrote:
 Hi,

 I've finally gotten round to upgrading my DMD to v2.062 (from 
 v2.059) -
 running on Win XP.

 I've had no issues recompiling the (quite old) DFL library I 
 use with
 the latest DMD, so went on to rebuild a tool I previously 
 developed
 (that uses DFL). Everything compiled ok, but the linker choked 
 on my RES
 file. (This project build fine and worked perfectly on 
 previous versions
 of DMD up to and including v2.059). The error is:

 OPTLINK (R) for Win32  Release 8.00.12
 Copyright (C) Digital Mars 1989-2010  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 atrchecker.RES(3) : Error 52: .DEF Syntax Error
 DO

I suspect your build script has somehow omitted a ',' from the command line in its invocation of optlink. The usage is LINK obj[,out[,map[,lib[,def[,res]]]]] so if a comma misses, your resource file is interpreted as a def file. If you are invoking the linker through dmd, you might want to check the linker call by adding "-v" to the command line.

Hi Rainer, I am actually using Visual-D (v0.3.35), so I've tested your idea by copying + pasting from .\Debug\<ProjectName>.buildlog.html into a batch file - and then building using this batch file rather than Visual-D. And your hunch was spot on! If I modify the the linker invocation with an extra comma (i.e. as in ... "C:\dmd2\windows\lib\",,atrchecker.RES/NOMAP/CO/NOI /SUBSYSTEM:WINDOWS ..) it builds fine; without the extra comma it fails with the same error as before. I suppose this is then a Visual-D issue and not a DMD linker issue, right? Regards, Ettienne
Apr 22 2013
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 4/22/13, Ettienne <ettienne.gilbert gmail.com> wrote:
 it turned out that the problem was as Rainer Schuetze suspected.

I should have known from the error message. Anyway there might be more useful stuff about resources here: http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/WindowsResources
Apr 22 2013
prev sibling next sibling parent "Ettienne" <ettienne.gilbert gmail.com> writes:
On Monday, 22 April 2013 at 22:19:39 UTC, Rainer Schuetze wrote:
 Yes, it should be fixed in the rc for the next version: 
 http://www.dsource.org/projects/visuald/browser/downloads/VisualD-v0.3.36rc5.exe

Hi Rainer, With VisualD-v0.3.36rc5 (Win XP 32bit, VS 2008) I get an install error: "Error loading C:\Program Files\VisualD\visuald.dll. Invalid access to memory location" I tried also with VisualD-v0.3.36rc4 - but get the same error. If I re-install VisualD-v0.3.35 it installs fine. Regards, Ettienne
Apr 23 2013
prev sibling parent "Ettienne Gilbert" <ettienne.gilbert gmail.com> writes:
On Wednesday, 24 April 2013 at 06:33:22 UTC, Rainer Schuetze 
wrote:
 XP support for DLLs seems to have been broken between rc3 and 
 rc4 ;-( I'll have to investigate... The fix for the command 
 line is in rc1.

Hi Rainer, OK, that's no problem - I'll just stick to rc3 for now then. Thanks for analyzing the problem. Cheers, Ettienne
Apr 24 2013