News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

how to add a .rc file or .res file to my project?

Started by jannes braet, June 18, 2012, 10:17:29 PM

Previous topic - Next topic

jannes braet

hello
i'm following the iczelion's win32 assembly tutorial (http://win32assembly.online.fr/tut8.html) and in this tutorial he makes a .asm file and a .rc file. i have saved the .rc file in the same folder as the .asm file and i have also compiled it to a .res file. now if i try to compile the file and if i run it it doesn't show a menu (which should be supposed to do) so now i think i'm doing something wrong with my Link:
in cmd i type : Link /SUBSYSTEM:WINDOWS hello.obj
but i believe i should add something to this to link the .res file to this but i don't know what. can someone please help me out with this?
(source codes are in the link i showed)

hutch--

Hi Jannes,

You use the linker, either as a RES file or after converting it to an OBJ file with CVTRES.EXE. For the RES file or the extra OBJ file you need to add it to the object file list on the command line.

Use a command line like this.


\masm32\BIN\Link.exe /SUBSYSTEM:WINDOWS mangled.obj rsrc.obj

clive

\masm32\bin\ml -Fl -coff -c hello.asm
\masm32\bin\rc hello.rc
\masm32\bin\link /SUBSYSTEM:WINDOWS hello.obj hello.res
It's a pity the clowns in Washington DC don't understand the Constitution as well as Edward Snowden

jannes braet


Vortex

Hi Jannes,

There is also Pelle's resource compiler coming with the Masm32 installation :

\masm32\bin\porc.exe

NoCforMe

Quote from: clive on June 18, 2012, 11:50:58 PM
\masm32\bin\ml -Fl -coff -c hello.asm
\masm32\bin\rc hello.rc
\masm32\bin\link /SUBSYSTEM:WINDOWS hello.obj hello.res

Hmm, that's odd: I notice you didn't include the CVTRES step:
cvtres /machine:ix86 hello.res
Is this not needed? Have I been doing this (in my batch files) needlessly?

I'm using LINK just like you, except I'm linking the .obj created by CVTRES. So can you link the .res file directly? What's the difference?

dedndave

i didn't know you could do that with MS link
i know that PoLink will accept a RES file directly, though

hutch--

From memory LINK calls CVTRES if the appended file has a RES extension.

NoCforMe

Quote from: hutch-- on June 19, 2012, 03:15:58 PM
From memory LINK calls CVTRES if the appended file has a RES extension.

OK, so 6 of one and half a dozen of the other (invoking CVTRES explicitly in the batch file vs. just linking the .res file), right?

hutch--

 :biggrin:


yourdrive:/>path\cvtres.exe /?


Yields,



Microsoft (R) Windows Resource To Object Converter Version 5.00.1736.1
Copyright (C) Microsoft Corp. 1992-1997. All rights reserved.

usage: CVTRES [options] ResFile

   options:

      /MACHINE:{IX86|ALPHA|ARM|AXP64|IA64|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
      /NOLOGO
      /OUT:filename
      /READONLY
      /VERBOSE
      /WINDOWSCE[:{CONVERT|EMULATION}]

Vortex

Quote from: dedndave on June 19, 2012, 03:08:34 PM
i didn't know you could do that with MS link
i know that PoLink will accept a RES file directly, though

Hi Dave,

Yes, polink does not depend on another tool. It accepts a compiled resource file directly.

clive

Quote from: NoCforMeHmm, that's odd: I notice you didn't include the CVTRES step
Indeed, it's a shortcut, a lot of compilers and linkers are even smarter that this. In fact some will take DLL's as inputs and figure out the linkage, rather than fanny around with imp/exp/lib type files.

LINK will run tools like CVTRES and CVPACK

You can use "CL hello.c setargv.obj" and it will downstream the object to the linker.
It's a pity the clowns in Washington DC don't understand the Constitution as well as Edward Snowden