Hi there!!

I am studying with Iczelion's tutorials.
In Iczelion's samples, there are lines like these


include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib

Is it possible to make these lines like this

include windows.inc
include user32.inc
include kernel32.inc
include gdi32.inc
includelib user32.lib
includelib kernel32.lib
includelib gdi32.lib

by modifying link options?
I want to move masm32 directory from C:\masm32 to C:\LANGUAGES\masm32.
but I don't want to make these line like this.(It's too long.)

include \LANGUAGES\masm32\include\windows.inc
include \LANGUAGES\masm32\include\user32.inc
include \LANGUAGES\masm32\include\kernel32.inc
include \LANGUAGES\masm32\include\gdi32.inc
includelib \LANGUAGES\masm32\lib\user32.lib
includelib \LANGUAGES\masm32\lib\kernel32.lib
includelib \LANGUAGES\masm32\lib\gdi32.lib


I tried this,
link /SUBSYSTEM:WINDOWS  /LIBPATH:C:\LANGUAGES\masm32\include tutorial.obj

but it didn't work. I can't understand.



And one other thing. In tutorial 8,Iczelion introduces "menu",that is a resource file,***.rc.
How am I supposed to compile and link?

Up to tutorial 7, I was able to compile and link as instruced in tutorial 1,that is

ml  /c  /coff  /Cp tut1.asm
link /SUBSYSTEM:WINDOWS  /LIBPATH:C:\masm32\include tut1.obj

But now,there are 2 files,main.asm and resource.rc.
How should I?



Posted on 2009-09-13 16:07:43 by shack
Well first you compile the rc file into a res file using  and then you link it along :)

Here's the scoop from the Readme.txt file inside Icz Tutorial 8:


ml /c /coff /Cp menu.asm
rc menu.rc
link /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib menu.obj menu.res


Cheers,
JimmyClif
Posted on 2009-09-13 16:38:19 by JimmyClif
Thaaaaanks!
Now I can go on with the rest of the tutorials.




BTW, do you know why link option    /LIBPATH:  doesn't work? 

I tried to remove the line completely like from

link /SUBSYSTEM:WINDOWS  /LIBPATH:C:\masm32\include tutorial.obj
to
link /SUBSYSTEM:WINDOWS  tutorial.obj

but I could still link perfectly.
What's the purpose of /LIBPATH then if I don't need it to link?

It all seems depends on how I write in the ***.ASM,
not on how I write in the command line,
and there seems no way to set the library path from link.exe.

Is it possible to set the path from link.exe?
Posted on 2009-09-13 17:10:14 by shack
Dig up the OA32 source code, it has internal macros which do what you want. I don't know if MASM has an equivilent to the NASM %!<env> option but if you plan to always use that folder you could technically add a macro like:

IncludeEx MACRO x:REQ
   Include @CatStr( <\LANGUAGE\masm32\include\>, x )
ENDM

IncludeBoth MACRO x:REQ
   Include @CatStr( @CatStr( <\LANGUAGE\masm32\include\>, x ), <.inc> )
   IncludeLib @CatStr( @CatStr( <\LANGUAGE\masm32\lib\>, x ), <.lib> )
ENDM


Then use them like this:

    .386
   .Model Flat, StdCall
   Option Casemap: None

   IncludeX windows.inc
   IncludeX macros.asm ; just something random...

   IncludeBoth Kernel32
   IncludeBoth User32
   IncludeBoth Gdi32
;...


Keep in mind I don't actually use MASM32 (I rarely even use MASM but when I do I use GeneSys), but I'm pretty sure that code should work.
Posted on 2009-09-13 17:11:48 by Synfire
Thank you

But If I have to use and add and study macro and nasm, I'll accept this as it is and write long lines,after all it's only 5 or 6 lines... Maybe I'll use them after I finish Iczelion's tutorials and progress in my study.

In C language,there is a line
"include <stdio.h>", it's not
"include<c:\program files\microsoft\c_builder\bin\stdio.h>".
I thought MASM is working like this and I could make the ***.asm code a little bit simpler.

but if things are not that simple,....yeah,I'll accept that.

Thank yoooooou!
Posted on 2009-09-13 17:42:47 by shack
Sorry for the confusion, but the above macro I posted is MASM code. My remark about the %!<env> option was in regards to doing (what is normal usage in NASM):

%defstr _incpath_ %!<NASM_INCLUDES>


then:

%macro inc 1
%push _inc_
%strcat %%tmp _incpath_, %{1}
%include %%tmp
%endm

inc windows.inc
inc kernel32.inc
; etc...

Posted on 2009-09-13 18:07:39 by Synfire
OA32 has a macro for almost everything :)
This one includes both .inc and .lib, using standard masm paths, and handles multiple files :)


IncludeAPIs ComDlg32, AdvApi32, msvcrt, Ole32, OleAut32, wsock32,ws2_32 ;Includes these APIs


How cool is that?
MASM has a very powerful macro engine, OA32 is (mostly) a set of MASM macros that make your life easier and your code more readable and shorter to type. It has some higher uses too, but I don't want to sound like a salesman, even if it is 100% free and open sourced.
Posted on 2009-09-14 02:03:05 by Homer
Thanks Homer,but what is "OA32"? 
Is it another assembler?
Where can I download it then?

I think I have to use MASM untill I finish Izcelion,because subtle differences in grammer among assemblers is really confusing to a noob like me, but I think after I finish the basics of assembly language,maybe I could use it?
Posted on 2009-09-17 17:48:27 by shack
Ouch. You said that it's MASM macro,(not an assembler)
so plz tell me where can I get that?
Posted on 2009-09-17 17:58:33 by shack
here - http://objasm32.winasm.net/
Posted on 2009-09-17 18:09:44 by lone_samurai5
As soon as you are comfortable with MASM syntax used in Iczelions tutorials, its time to begin investigating some of the examples and demos provided with OA32.
If you look at OA32 today, it will probably look scary... so don't.
Take your time, it wouldn't hurt to download OA32 now, but don't worry over it until you are ready to move on.
That time will be when your projects are starting to get bigger and more complex.. one major strength of OA32 is that it allows MASM coders to build very large and complex projects without losing their minds, and overcoming some serious limitations in MASM itself that occur due to things like "the symbol table limit" which, eventually, you WILL run into.
And then there's the 'encapsulation' argument - OA32 lets you build 'code objects' which are a set of related code and data wrapped into a 'brick' than you can easily re-use in your new projects, saving you the trouble of rewriting them (porting them) from one project to the next. Better yet, since you've built these objects before (MakeObjects macro), you can simply LINK them into new projects (LoadObjects macro), which means some seriously accelerated buildtimes for large projects - faster to code, faster to build :)

When you do get around to using OA32, you will find that it looks and smells like a C++/MASM hybrid language, just remember that its ALL MASM CODE, you're simply using some new macros which LOOK like C++ !!!

Posted on 2009-09-17 23:24:46 by Homer
Yes you can do that.

Type ML /help to obtain help about MASM's command line options.

You might notice the " /I < name > Add include path " option.

Take care since INCLUDES and LIBS are not the same thing. The "includelib" statements inside ASM source are simply directives for transferring the command to the linker.

There is no /LIBPATH comamnd line option for ML.EXE (the assembler) but there is an /LIBPATH command line option to the LINK.EXE (the linker).

Hence IF you combine the /I option of the assembler with the /LIBPATH option of the linker THEN you might obtain what you want.

Anyway IMHO you will get better support for MASM on MASM32 forums: http://www.masm32.com/board/index.php
Posted on 2009-09-19 03:16:01 by BogdanOntanu

Anyway IMHO you will get better support for MASM on MASM32 forums: http://www.masm32.com/board/index.php


That's arguable. However, if you are looking for a slice of political fruitcake along with your programming endeavors, then I wholeheartedly agree :lol:
Posted on 2009-09-19 13:11:27 by SpooK
Heya Bogdan, and welcome back :)

We accept that there are alternative sources of information.
Please refrain from poisoning our threads.
We don't go there and do that.
Thanks :)
Posted on 2009-09-20 23:46:22 by Homer