News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to set the path for the include files?

Started by Sergiu FUNIERU, February 24, 2010, 01:06:30 AM

Previous topic - Next topic

Sergiu FUNIERU

I want to do something like this in my index.asm file

set include_path = c:\masm32\include
include %include_path%\windows.inc

Is it possible? What is the correct syntax?


dedndave

set INCLUDE=C:\masm32\include
set LIB=C:\masm32\lib
set MASM=C:\masm32\bin
set PATH=C:\masm32\bin;%PATH%

those are the paths
but, if you want them to stay that way, you have to open the system icon and edit the system environment variables

http://www.masm32.com/board/index.php?topic=13263.msg103078#msg103078

Sergiu FUNIERU

Quote from: dedndave on February 24, 2010, 01:59:44 AM
set INCLUDE=C:\masm32\include
set LIB=C:\masm32\lib
set MASM=C:\masm32\bin
set PATH=C:\masm32\bin;%PATH%

those are the paths
but, if you want them to stay that way, you have to open the system icon and edit the system environment variables

http://www.masm32.com/board/index.php?topic=13263.msg103078#msg103078
Can I do this inside my asm file? That's my problem.

jj2007

You can do all sorts of manipulation, set environment variables, use makefiles, whatever. The more important question is "what happens if your code snippets posted here do not follow the forum habits"..

include \masm32\include\masm32rt.inc


After installation, Masm32 has a hardcoded tree structure. You may have it in C:\masm32\ or D\masm32\, for example. Using \masm32\ makes sure that a forum member who has it in Y:\masm32\ can assemble your code, too.

By the way: There are plenty of posts from newbies (not you) with a dozen lines of complex code but no proper headers such as includes, protos etc.; what these young friends implicitly say is "can one of you old fellas who have nothing else to do please construct a skeleton using my snippet and then test it for me?"

Sergiu FUNIERU

Quote from: jj2007 on February 24, 2010, 02:05:33 AMThere are plenty of posts from newbies (not you)
You're kind with me. Thank you!


Quote from: jj2007 on February 24, 2010, 02:05:33 AMYou can do all sorts of manipulation, set environment variables, use makefiles, whatever. The more important question is "what happens if your code snippets posted here do not follow the forum habits"..
I completely agree with you in this matter. When I'll post the code, from now on, I'll use the relative paths, regardless of how my actual code looks. Of course, I'll test it first with relative paths.

I plan to write a small utility that will convert my code to the standard accepted format. This way, my code will be easier to read when I'll ask a question.

japheth

Quote from: Sergiu FUNIERU on February 24, 2010, 02:02:25 AM
Quote from: dedndave on February 24, 2010, 01:59:44 AM
set INCLUDE=C:\masm32\include
set LIB=C:\masm32\lib
set MASM=C:\masm32\bin
set PATH=C:\masm32\bin;%PATH%

those are the paths
but, if you want them to stay that way, you have to open the system icon and edit the system environment variables

http://www.masm32.com/board/index.php?topic=13263.msg103078#msg103078
Can I do this inside my asm file? That's my problem.

Yes. The internal macro function @Environ will allow you access to environment variables:


.386
.model flat

% include @Environ(INCLUDE)/macros.inc


The % is required to enable "macro expansion" for the INCLUDE directive. Thus @Environ(INCLUDE) will be replaced by the value of environment variable INCLUDE. Also note the '/' instead of the backslash. This is a Masm quirk, needed when macro expansion is on - for JWasm its also ok, but unnecessary.


Sergiu FUNIERU

Quote from: japheth on February 24, 2010, 07:25:12 AMYes. The internal macro function @Environ will allow you access to environment variables:
Thank you very much! This is what I was looking for.

BlackVortex

Interesting functionality there.

If you're using only one assembler though, it's easier to have your include folder in the path.

Sergiu FUNIERU

Quote from: BlackVortex on February 24, 2010, 01:12:25 PMIf you're using only one assembler though, it's easier to have your include folder in the path.
That's a nice idea. I'll stick to JWasm for the foreseeable future and I'll definitely try your suggestion. Thank you.

I have to read in the manual if JWasm will look in the path first.

On the other hand, it would not be risky if in the path there are some other include files, let's say from other libraries?

BlackVortex

They won't have the same name. Besides, you'll have only one include folder in your path.

Sergiu FUNIERU

Quote from: dedndave on February 24, 2010, 01:59:44 AM
set INCLUDE=C:\masm32\include
set LIB=C:\masm32\lib
set MASM=C:\masm32\bin
set PATH=C:\masm32\bin;%PATH%

those are the paths
but, if you want them to stay that way, you have to open the system icon and edit the system environment variables
For small programs, I use the same batch file to compile. The name of the program is always index.asm, and the paths are hardcoded inside that bat file. In this way, I'll not affect the system environment variables, not to mention that it's easier for me to edit the bat file.

The paths are set only for the time when the bat programs run.