Is it possible to use Visual Studio to write intel assembly? - visual-studio

As the title states really, is it possible to write assembly code in visual studio?
Im looking for an easy to use IDE for writing intel assembly language. I looked at a few IDEs a few months ago and unless they required lots of configuration settings (I copy and pasted examples into the IDE) they wouldnt work......
There must be a simple IDE very similar to VS where you can write your assembly, pick CPU and then execute?

The inline assembler in Visual Studio isn't reliable, but you can use Visual Studio in conjunction with MASM (the Microsoft Macro Assembler) to write straight assembly programs.
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/c53fd4fd-e239-464a-b512-2b2fc8745c88
http://msdn.microsoft.com/en-us/library/afzk3475.aspx
http://www.masm32.com/index.htm
http://www.daniweb.com/software-development/cpp/threads/8072
http://www.infernodevelopment.com/introduction-masm32
Writing the "glue" code that opens a window, sets up output, etc in assembly is rather painful, so you may find it more comfortable to write most of your program in C++, and just a couple of files in assembly. That way you can start by writing simple test functions in straight assembly, and call them from your C++ framework.

This should help you out Setting Up Visual Studio 10 for MASM32 Programming

Related

Is there something that improves the c++ interpreter built in to Visual Studio 2010?

I'm going to school for computer programming and I have been using Xcode and really like its predictive text input (or whatever you call it maybe interpreter). The only thing is that it seems to function a little different when creating a C++ project. Such as you don't have to say "#include " to use the string library. Where as in Visual Studio you have to. What i'm afraid of is turning in a class project done on Xcode and missing including a lib and losing points. So i would like to do it on VS 2010 but i would like to have a better interpreter. Any help on this.
I think you mean AutoComplete..... and there is an add on called Visual Assist X that makes it magic for C++ coding.

f# compiling too slow

I'm new to f#. I downloaded the Visual Studio 2010 shell and the F# ctp and wrote a small hello world script with the following code
printfn "Hello World"
let _ = System.Console.ReadLine()
This takes around 13 to 15 seconds to compile which is very slow compared to running a similar C# script(which takes around 2 secs). I'd like the F# script to compile faster so that my development(i.e. experimentation) time would be reduced, I don't care for the runtime performance.
Is there any way to make the F# script compile faster, maybe turn on/off some Build settings in Visual Studio or something like that?
FYI, I'm using a 4 year old pentium 4, 1.5 gb RAM machine, if that helps.
I have no idea how fast a Pentium 4 should compile that "hello world" program, but 15 seconds strikes me as pretty slow. I once had similar speed problems with a VS 2010 Beta and the problem turned out to be that Visual Studio and the F# compiler weren't yet properly NGENed.
Normally, the Visual Studio install should make sure that everything gets NGENed, but maybe something went wrong. You can check if the F# compiler was NGENed with the following command in a console window with admin rights:
cd "C:\Program Files\FSharp-2.0.0.0\bin"
c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe display fsc.exe
If the result of that shows that the native image of fsc.exe is still pending, you could force the compilation with:
c:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe executeQueuedItems
Note: I'm not sure which version of the F# compiler you're using exactly. The one used by the full install of VS2010 is the one in C:\Program Files\Microsoft F#\v4.0 (or C:\Program Files (x86)\Microsoft F#\v4.0 on 64-bit machines). So, if you use that one, you have to cd into that folder instead of the C:\Program Files\FSharp-2.0.0.0\bin folder.
Unfortunately there isn't much you can do -- the F# compiler is just slower than the C# compiler. But let me explain why:
Why the F# compiler is slower than the C# compiler
First, the F# compiler is written on .NET, the C# compiler is written in C++.
While this alone isn't a death sentence to perf, it does make a difference. Second, the C# compiler is 10+ years old. There has been a lot of time to tune and optimize it -- both the compiler itself and the .NET runtime. The .NET JIT engine has been fine-tuned for C#/VB.NET and not F#. Functional programming requires a lot of short-lived objects, which translates to different type of GC behavior.
But the real reason why the F# compiler is noticeably slower than the C# compiler is because it is doing more work than the C# compiler. In C# you provide all of the type information, which in a way is you doing work for the compiler. F# on the other hand does type inference for you, which while saving you from the burden of annotation does require additional CPU time.
What you can do
I recommend you download the Visual Studio 2008 shell and use F# targeting the .NET Framework 2.0. Unless you need something that is in Visual Studio 2010 or CLR 4.0 only, you will be fine on Visual Studio 2008. The F# language functions the exact same. The only difference, IIRC, is in what types certain things compile to. For example, there is a Tuple<_> type built into CLR 4.0, but when targeting CLR 2.0 the tuple type defined in FSharp.Core.dll is used.
Visual Studio 2010 offers a lot of slick bells and whistles, such as a WPF-based code editor. However, those niceties consume a lot of RAM and in your case it sounds like you can live without them.
Note also that you can use F# Interactive to evaluate snippets of code or scripts, and since the FSI window in VS stays open, it is much faster (the startup time for fsc.exe is bad).

What tools are available for F# debugging?

Are there gdb (or similar) for F#?
What tools/programs do F# programmers normally use for tracing F# code in Mono?
Does Visual Studio 2010 provides some integrated debugging tools for F#?
Visual Studio 2010 provides a fantastic debugging experience for F#, including breakpoints, tracepoints, call stacks, locals, stepping, set next statement, threads window, poking new values into variables, debugger visualizers, conditional breakpoints, immediate window, ... the only caveat is that the last two use the C# expression evaluator (F# does not have its own debugger EE), which means you must type e.g. C# syntax into the 'immediate window'.
(Everything I mentioned above is available for free if you download the free VS2010 Integrated Shell and the F# CTP.)
I am not sure what is available right now for Mono, but would not be surprised if there is something decent already, and something even better coming in the not-too-distant future.
Mono has its own debugger. The debugging format situation is slightly confusing because Visual Studio will generate pdb files which are needed for their debugger. Mono uses the alternative mdb format. fsc.exe (The f# compiler) will generate the appropriate ones for whichever platform it is run on.
The Monodevelop IDE can be used for general debugging of .net assemblies, even though it doesn't support a released f# version yet. You'll need to refer to your project's generated assemblies in the project.
Note that you also have to pass '--debug' to mono if you're executing it on the command line and want, for example, file names and line numbers in stack traces.
Any .NET debugger should work on F# code. The Visual Studio debugging experience is basically the same as for any other language (e.g. you can set breakpoints in the editor, etc.). I can't speak to what tools people use on Mono.
LinqPad understands F# code but I did not try it. A paid version gives you debugging.

Visual Studio, Intel Visual Fortran, and Visual C/C++ mixed-language compile

Working with Visual Studio 2008 Pro, with Intel Fortran compiler v11, on Windows 7 x64.
I have an Intel Visual Fortran project set up with all the fortran source files. I wish to gradually replace all these subroutines with C/C++ (actually cuda -- bonus points). Simply right clicking on source files in the solution explorer and "add existing item" will put a .cpp or .c or cuda file in the list... but it never gets compiled. Thus any INTERFACE to C code written into the fortran code always fails on the link step.
How does one get a mixed-language project like this? Google has failed me, and all I find are descriptions of the actual interface code, with no instructions on how to implement the visual studio build system.
Thanks in advance.
A Visual Studio project can only contain code elements from a single language. To mix C++, CUDA and Fortran, you must set up a Visual Studio Solution. Then you are free to integrate multiple languages.
A useful guide to setting up a CUDA multi-language VS 2010 Solution can be found here.
[This answer has been assembled from comments and added as a community wiki to get this question off the unanswered list for the CUDA tag].

What is the VS 2008 IDE Written in?

I tried to search but if this is a duplicate it is hidden by some noise. Alternate title to the question:
What skills to look for when needing integration with the Visual Studio IDE?
Visual Studio 2008 is written in both native and managed code, though the bulk is written in C++. There are several pieces of Visual Studio that have always been written in managed code (e.g. the property browser, the WinForms Designer). And of course, Visual Studio 2008 is stitched together with COM.
In Visual Studio 2010, there is an effort to move more of the IDE to managed code. The text editor and the shell (i.e., menus, toolbars, document and tool window frames, etc.) are written in C#. In addition, pieces of the C# and VB IDEs are being written in C# and VB respectively. The new language, F#, is written completely in managed code -- the compiler, the language service, the project system, etc. -- are all written in F#.
You can use C#, VB or C++ to integrate with Visual Studio 2008. However, given that Visual Studio is built on COM, a good understanding of COM/ATL will be helpful. In addition, if you choose to use a managed language, a knownledge of COM interop and mixed-mode debugging will be extremely helpful. Note that there are a few levels of VS integration:
Macros -- the simplest way to run custom code in the IDE.
Add-in -- A simple but powerful way to build custom functionality into the IDE. With an add-in, you can create custom commands, listen to events, manipulate text in the editor, etc. However, you cannot add, say, a new language or editor to the IDE with an add-in. For many purposes, an add-in works fine.
Package -- this is the same level of integration as Microsoft's features use. With a package, you can create pretty much anything in the Visual Studio IDE, including adding new languages.
You should note that these become progressively more complex to author and deploy.
In Visual Studio 2010, a new form of extensibility is being introduced in several areas of the IDE, but primarily for extending the new WPF text editor. Going forward, integration with Visual Studio will require MEF (Managed Extensibility Framework) components rather than COM. So, in VS 2010, extending the text editor will simply require authoring a MEF component in your favorite managed language.
The podcast Herding Code episode #48 features an interview with Dustin Campbell, a program manager on the Visual Studio Managed Languages Group.
In that interview he talks for several minutes about this exact issue and gets into details about why the changes in 2010 are breaking compat with 2008 and how the future looks.
If this is strictly a curiousity question the other answers are correct. But if you want to dig a little deeper, listening to the podcast would be well worth your time.
At least the following languages are used inside of Visual Studio 2008
C++
C#
VB.Net
C
C++/CLI
C++ with managed extensions
Probably a few others that I forgot about.
A mix. The core is C++/COM stuff, but a lot of the newer stuff is managed code (C# etc). Due to the core being C++/COM (with a pile of code 'borrowed' from MS Office), VS integration is a funny experience.

Resources