News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Newbie compile

Started by asmator, March 27, 2020, 05:09:02 AM

Previous topic - Next topic

asmator

I am trying to compile a code I have in "C:\My dir\layout.asm"
My MASM is installed in "E:\masm32"
First issue is that I can't call build.bat from "C:\My dir\" (E:\masm32\bin\build "C:\My dir\layout"), as build.bat is not ready and tries to find the inexistent C:\masm32.
Second issue, if I call it from E, the .obj file is created in my current directory, so it is never found by the linker.

I can add a E: inside de BAT, but then libraries are not found. I might compile code from any drive, not only from C:

What is the right way to do this? I find it a bit odd that build.bat is not prepared for such things. Thanks

hutch--

Build you code on the same drive that MASM32 is installed on, its done this way on purpose. Once you have the app working properly, then copy it to the location you require.

asmator

So there is no actual solution, the right way is to move files.

I think I read long time ago about the reasons for this, but I don't remember them now. I recall it was something sensible, but perhaps not for 2020. This is very inconvenient, so in the end I will just have to duplicate the masm32 directory in every drive I want to use. Placing it in the root is also annoying. Thanks for your answer.

HSE

There is a lot of solutions , but I have a masm32 sdk in every drive  :biggrin:.

You can write hard paths  in your code :      include e:\masm32\include\user32.inc
      include e:\masm32\include\kernel32.inc

      includelib e:\masm32\lib\user32.lib
      includelib e:\masm32\lib\kernel32.lib
      etc.


And add to the PATH "e:\masm32\bin"
Equations in Assembly: SmplMath

asmator

This looks better, although I think it needs modification of the build.bat, otherwise it will raise "The system cannot find the path specified."

Is it possible to define consts for the includes? To simplify the paths:
include MYCONST\user32.inc

HSE

Quote from: asmator on March 27, 2020, 10:20:45 AM
Is it possible to define consts for the includes? To simplify the paths:
include MYCONST\user32.inc

MYCONST textequ <\masm32/include>
But you have to use:
% include MYCONST\user32.inc
this work with AsmC and UASM, I don't remember if ML understand that.
Equations in Assembly: SmplMath

jimg

You can use this for all include files except possibly one.  \masm32\include\masm32rt.inc  has include lines in itself, so may not work without modification.

Also the uselib macro has includes in it so may not work.


But you could just do it with a make.bat file:


set mydrive=F:
%mydrive%\masm32\BIN\ML /c /coff /Cp /nologo /I"%mydrive%\masm32\INCLUDE" "Utilities.asm"
%mydrive%\masm32\bin\link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 "/LIBPATH:%mydrive%\masm32\LIB" "Utilities.obj" "/OUT:Utilities.exe"


which points to all the include and lib files.

hutch--

I fail to see why anyone is so inflexible that they must try and ape the same old mistakes that others have made for years.
Quote
I recall it was something sensible, but perhaps not for 2020. This is very inconvenient, so in the end I will just have to duplicate the masm32 directory in every drive I want to use. Placing it in the root is also annoying.
Long ago there were so many people who put it in the wrong location because they did not bother to read the data in the installer then came back with "It dozen wurk" that later installs were locked at "root:\masm32". Then some would try to move the whole directory tree elsewhere with yet another round of "It dozen wurk".

The politically correct technique in the "daze" of old was to set environment variables for LINK ML CL and RC but then when you had multiple programming environments, you ended up with the wrong version of ML LINK etc ....

The installation of MASM32 is safe from other environments and can have MSVC(multiple versions) in 32 and 64 bit installed on the same drive and nothing clashes and you never get the wrong version of anything. I am yet to understand why moving a finished executable to its final location is so difficult.

asmator


asmator

Quote from: hutch-- on March 27, 2020, 11:43:57 AM
I fail to see why anyone is so inflexible that they must try and ape the same old mistakes that others have made for years.
Quote
I recall it was something sensible, but perhaps not for 2020. This is very inconvenient, so in the end I will just have to duplicate the masm32 directory in every drive I want to use. Placing it in the root is also annoying.
Long ago there were so many people who put it in the wrong location because they did not bother to read the data in the installer then came back with "It dozen wurk" that later installs were locked at "root:\masm32". Then some would try to move the whole directory tree elsewhere with yet another round of "It dozen wurk".

The politically correct technique in the "daze" of old was to set environment variables for LINK ML CL and RC but then when you had multiple programming environments, you ended up with the wrong version of ML LINK etc ....

The installation of MASM32 is safe from other environments and can have MSVC(multiple versions) in 32 and 64 bit installed on the same drive and nothing clashes and you never get the wrong version of anything. I am yet to understand why moving a finished executable to its final location is so difficult.

Sorry, I didn't mean any offense. And you are totally right about the "it doesn't work", I would find it irritating too.

Personally, for me, it is just annoying to leave .obj files and having to move .exes every time I compile. I prefer, because technology makes it possible (--I just need to find the way, within my clumsy understanding of how things work and my laziness), to press a button and have everything compiled with no extra action on my side. The less manual work, the better (for me) But I understand not everyone is the same.

hutch--

Try this then, if its a project that you have to work on for days or weeks etc .... modify the batch file with a copy command at the end so it is copied to the location of your choice at each build. I do this reg ularly with tools that I use that need maintenance.

asmator

Quote from: hutch-- on March 27, 2020, 12:51:55 PM
Try this then, if its a project that you have to work on for days or weeks etc .... modify the batch file with a copy command at the end so it is copied to the location of your choice at each build. I do this reg ularly with tools that I use that need maintenance.

Yes, I avoided the default build.bat to create my own, and used some of the suggestions made above. I can run it nicely now from the prompt, from Total Commander and from Sublime Text.

Thank you all for your help.

daydreamer

Quote from: hutch-- on March 27, 2020, 12:51:55 PM
Try this then, if its a project that you have to work on for days or weeks etc .... modify the batch file with a copy command at the end so it is copied to the location of your choice at each build. I do this reg ularly with tools that I use that need maintenance.
nice idea,maybe could be extended to be used for test purpose:develop ASM on one computer and copy exe's to several other computers connected in LAN and time on different cpus and get back to change code because not satisfied and test again?

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding