Author Topic: how to add a .rc file or .res file to my project?  (Read 15004 times)

jannes braet

  • Guest
how to add a .rc file or .res file to my project?
« on: June 18, 2012, 10:17:29 PM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: how to add a .rc file or .res file to my project?
« Reply #1 on: June 18, 2012, 11:45:51 PM »
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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

clive

  • Regular Member
  • *
  • Posts: 27
  • Toolsmith and Assembler coder (x86,ARM,MIPS,68K)
Re: how to add a .rc file or .res file to my project?
« Reply #2 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
It's a pity the clowns in Washington DC don't understand the Constitution as well as Edward Snowden

jannes braet

  • Guest
Re: how to add a .rc file or .res file to my project?
« Reply #3 on: June 19, 2012, 01:36:46 AM »
thanks. it works now.

Vortex

  • Member
  • *****
  • Posts: 2794
Re: how to add a .rc file or .res file to my project?
« Reply #4 on: June 19, 2012, 03:51:27 AM »
Hi Jannes,

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

Code: [Select]
\masm32\bin\porc.exe

NoCforMe

  • Guest
Re: how to add a .rc file or .res file to my project?
« Reply #5 on: June 19, 2012, 02:44:12 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:
Code: [Select]
cvtres /machine:ix86 hello.resIs 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

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: how to add a .rc file or .res file to my project?
« Reply #6 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

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: how to add a .rc file or .res file to my project?
« Reply #7 on: June 19, 2012, 03:15:58 PM »
From memory LINK calls CVTRES if the appended file has a RES extension.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

NoCforMe

  • Guest
Re: how to add a .rc file or .res file to my project?
« Reply #8 on: June 19, 2012, 03:28:17 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--

  • Administrator
  • Member
  • ******
  • Posts: 10583
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: how to add a .rc file or .res file to my project?
« Reply #9 on: June 19, 2012, 04:08:35 PM »
 :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}]
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Vortex

  • Member
  • *****
  • Posts: 2794
Re: how to add a .rc file or .res file to my project?
« Reply #10 on: June 20, 2012, 04:11:16 AM »
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

  • Regular Member
  • *
  • Posts: 27
  • Toolsmith and Assembler coder (x86,ARM,MIPS,68K)
Re: how to add a .rc file or .res file to my project?
« Reply #11 on: June 20, 2012, 04:20:42 AM »
Quote from: NoCforMe
Hmm, 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