News:

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

Main Menu

Using Visual Studio and Masm32 SDK or Masm64 SDK

Started by zedd151, September 26, 2024, 10:25:01 PM

Previous topic - Next topic

zedd151

Proposal:

There have been numerous new members coming on board that already have Visual Studio set up as their programming environment (which is good, as they have the 64 bit binaries already  :wink2:). Then they also wish to use either Masm32 SDK or Masm64 SDK to build assembler projects.

It seems clear to me that perhaps there should be a separate board for VS + Masm users. The experienced members here that do use Visual Studio, could then (theoretically) give some guidance on how to properly set up Visual Studio and either Masm32 SDK or Masm64 SDK to work together, what VS settings are needed to build a release or debug version of their projects, path related help, etc. (some use differing paths than most users use)

As both of the SDK's were designed to be used independently without the need for Visual Studio or any other IDE, many members do not have Visual Studio on their computer nor a desire to do so. Therein lies a necessity so that Visual Studio issues do not wind up in the Campus for instance. Case in point

Also when VS users post their code, there is usually an incomplete header as Visual Studio apparently uses some sort of default for it (a guess on my part). And members that do not have VS, in order to help them, would have to insert their own header as well as construct their own command lines or a batch file to build the project for debugging purposes to help the member that posted a request for help. Tedious at best.

Any helpful comments or advisements are welcome. Trolls unwelcome.  :smiley:

Not sure where to post this for better visibility or where most appropriate.

C3

Setting up Visual Studio is quite an easy task. Its very nice to use with good debugger. Can use Git to push to GitLab/GitHub, can also pull projects from online sites with Git.

But theres some more. Hutch/Vasilys include files are not complete and need manual addons time to time, when something is found what is not there yet.

Also include libs, like:

\masm64\lib64\kernel32.lib

28/04/2020  17:22           213,016 kernel32.lib
               1 File(s)        213,016 bytes

C:\Program Files\Microsoft Visual Studio\2022\Community\SDK\ScopeCppSDK\vc15\SDK\lib\kernel32.lib

30/11/2022  20:33           297,196 kernel32.Lib
               1 File(s)        297,196 bytes

Differ in size, so they are not equal in content. Same equals to other include libs this was a single case to compare.

Cheers,
Petter

BugCatcher

Masm64 is becoming old. Visual Studio uses newer versions with more code. And always an updated masm.

zedd151

Quote from: BugCatcher on September 27, 2024, 01:31:14 AMMasm64 is becoming old.
ml64 is not included in the Masm64 SDK, that was always left up to the user to obtain - because of Microsofts licensing restrictions it could not be redistributed within the Masm64 SDK like ml.exe was within the Masm32 SDK.

Quote from: C3 on September 27, 2024, 12:38:48 AMHutch/Vasilys include files are not complete...

Also include libs...

The Masm64 SDK is still a Work-in-progress. (beta version)

Quote from: C3 on September 27, 2024, 12:38:48 AMSetting up Visual Studio is quite an easy task. Its very nice to use with good debugger.
That is good to know, thanks.




sinsi

Quote from: C3 on September 27, 2024, 12:38:48 AMSetting up Visual Studio is quite an easy task. Its very nice to use with good debugger.
Agreed. All you need are include files, the libraries are with VS (or the Windows SDK if you install that too).
ML and LINK command-line options are set via a properties dialog, one set for debug and another for release.

One thing to watch out for: bloat :biggrin:
Microsoft Visual Studio
7.74 GB (8,319,590,400 bytes)
49,531 Files, 7,649 Folders

Windows Kits
1.95 GB (2,100,789,248 bytes)
10,206 Files, 1,329 Folders
Of course, most of that is superfluous (C++ (and VB in my case)).

NoCforMe

How about at least a sticky post somewhere with basic instructions for using VS for those who don't know? Nice to leave at least a few breadcrumbs on this topic ...
Assembly language programming should be fun. That's why I do it.

jack

a web search gave this How to Use MASM in Visual Studio 2022
it's a bit late for me but I plan on trying it out tomorrow 

zedd151

Quote from: jack on September 27, 2024, 12:41:56 PMa web search gave this How to Use MASM in Visual Studio 2022
it's a bit late for me but I plan on trying it out tomorrow 
That wiki is for using VS and MASM (the assembler, i.e., ml.exe or ml64.exe), NOT either the Masm32 SDK or Masm64 SDK. I have modified the topic title to make this distinction.

While it is useful information, and thanks for the wiki link btw, it does not address using Visual Studio with either the Masm32 SDK or Masm64 SDK which is what this topic is about. Again, title changed to make the distinction.
Using only information in that link, one would not have access to the macros and libraries in the Masm(32 or 64) SDK's. That is the goal here. To try and make it easier for a user to have both Visual Studio and the use of the macros and libraries within the SDK's. All without having confused paths, the SDK in a location other than the default location (root of a drive), getting around VS's path changes in the registry, and a few other stumbling blocks that new members may find challenging while trying to use VS and either of the SDK's with each other as well as separately.  :smiley:

Side note not specifically pointing to any particular member or user: I am very surprised and dismayed to find out that there are quite a few members that do not even have either of the SDK's installed. Somewhat alarming  since that is why this forum was created. Not to simply just use ml.exe or ml64.exe for writing assembler code, but to take advantage of hutchs (and many other contributors) hard work in making the macros and libraries and putting together the SDK's. That is literally The reason for the forums existence in the first place.

C3

I did read that WikiHow-tutorial what Jack posted. Theres all you need to do when configuring Visual Studio after it, you just use MASM SDK what Hutch made available (include and includelib directives. To use includes, macros and libraries) from MASM32/64 folders. Last do setup of Project/Solution to configure ML/ML64 and LINK settings, choose Debug/Release and are you doing 32bit or 64bit software, and is it for Console or Window as Sinsi pointed previously.

zedd151

#9
Quote from: C3 on September 27, 2024, 11:56:59 PMI did read that WikiHow-tutorial what Jack posted. Theres all you need to do when configuring Visual Studio after it, you just use MASM SDK what Hutch made available (include and includelib directives. To use includes, macros and libraries) from MASM32/64 folders. Last do setup of Project/Solution to configure ML/ML64 and LINK settings, choose Debug/Release and are you doing 32bit or 64bit software, and is it for Console or Window as Sinsi pointed previously.
Perfect C3. Thank you.
Would you be willing to help out in The Campus if/when there are new members having issues using Visual Studio? Time permitting, of course.

Or (better option?) simply by making a one-time posting there (that can be pinned) on the steps needed to make Visual Studio ready for use in writing assembly projects (plus any useful tips)? That would be a great help, as many members like myself do not use Visual Studio. And such advice and knowledge is always better coming from an experienced, active member, than a wiki page.

Thank you for considering...

sinsi

zedd151, once you've set up VS for MASM, all you need is one line at the top of your source
include \masm64\include64\masm64rt.inc
or
include \masm32\include\masm32rt.inc

There's nothing magical about VS versus qeditor, or even notepad++.
VS gives you ML64 and LINK, installing the Windows 11 Kit gives you the latest libraries, that's it.
It's got a nice debugger though :biggrin:

NoCforMe

Assembly language programming should be fun. That's why I do it.

sinsi

I would also assume (lol) that anyone using VS would be familiar with it, just not familiar with the ASM setup.
I would expect a noob to use something easier, like qeditor - perfectly suited to the task. VS is overkill.

NoCforMe, there needs to be a coherent post to make it sticky. You are the documentation man, if we throw some stuff at you do you volunteer to break it down into bite-sized pieces?
I sure can't.

C3

Quote from: zedd151 on September 28, 2024, 01:10:23 AMWould you be willing to help out in The Campus if/when there are new members having issues using Visual Studio? Time permitting, of course.

Yes I am willing to help everyone here. I have received so much knowledge from you friends and I am willing to pass that knowledge forward, and document that knowledge here.

That Wiki tutorial has nice content of doing that Visual Studio setup, it's very small, and its very easy to setup. And as Sinsi said just add that one-line include to get default MASM SDK running.

I have clean virtual Windows 11 EDU VM where I could do tutorial, but it's all in that Wiki, so it would be duplicate? If theres really need for new tutorial posted to here I guess I could do that.

iZ!

I haven't tried in versions after vs2015, but it used to be like this - you check the C++ package during installation, then add a C++ project to the solution (don't worry C haters like me, you won't see a single line of C code  :smiley: ), right click it and under Build dependencies > Build customizations, tick MASM.
Add new C++ file and rename it to "something.asm".
If in x64 mode, then you're good to go - write your first PROC and call it from your fav managed language using DllImport or such. It's good to set the output directory to be the same for both, the managed and assembly.
The nice thing is you can assign memory to variables in managed lang., not having to worry about the stack. And debug altogether.
Oh.. and under properties, enable No Entry point