File Exchange

image thumbnail

Visual Studio Toolbar for mex interface with video tutorial

version 1.7 (5.71 KB) by

Seamless interface, VS 2010 and 2012 and Matlab for MEX. Video linked to step you through.

1 Download

Updated

View License

Automatically sets up debugging and running of MEX files from Visual Studio.
There is now a visual studio extension (simple click plugin type of install):
http://islab.hh.se/mediawiki/images/b/b0/VSMEX1.0.zip

The old type of Macros (that are not supported in newer versions of Visual Studio) are kept in the same zip file.

Video tutorial on my page:
http://islab.hh.se/mediawiki/index.php/Stefan_Karlsson/PersonalPage/mex_VS_tutorial

On youtube:
http://www.youtube.com/watch?v=JKDlPQZQqHk

Comments and Ratings (16)

Stefan Karlsson

@simon

Thanks for you interest. I will probably never make any new version of this, due to how microsoft have purposefully destroyed visual studio.

I will be happy to provide information to anyone who does take that cup up.

Excellent solution for developing and debugging mex code - is there any chance of this being updated for newer versions of both matlab and visual studio?? or can we adapt what we already have??

many thanks

Tom Clark

@Stefan,
Thanks. I don't know about *all* functionality, but will see what I can come up with next time I boot my windows box.

Stefan Karlsson

@Tom,

If you have info or links on how people may get the same functionality as this submission, through other means, please share. If its accurate, I will update the description of this submission to say DEPRECATED, and put your links in the description.

happy coding

Stefan Karlsson

@Tom,

My knowledge about VS and mexing in Matlab is really out-dated, and its great to hear that things are evolving.

The VSmex extension (this FEX submission) to visual studio is really not about solving difficult problems - its about automating and speeding up time-consuming/error-prone/boring tasks, such as accessing the VS debugger.

It is technically "easy" to devolp mex files just inside of Matlab by itself... Then you dont need VS at all.

just dont make any single mistakes, and your life of mexing will be all happy, all the time :)

Tom Clark

@Igor and everyone else: With newer VS extensions, it's not too hard to make a configuration to build mex files for you now. Use mex -v option in MATLAB to see the libraries you have to include, then add those libraries to your build configuration in VS. Then build a dll, but specify the output file to have a .mexw64 extension rather than the usual .dll.
There are also a range of other options in MATLAB nowadays for simply accessing vanilla .dll file libraries, so maybe we're seeing a shift away from the need to build custom libraries at all (I hope so). Still, thanks for your efforts in supporting this over the years @Stefan!

Stefan Karlsson

@Igor, and the world...

I am happy this has come to be useful. I will likely never develop this for a new version of Visual studio. Microsoft descided to remove support for Macros, which is what i based the first version of VSmex on. I then had to spend a week or more of work to convert my functions into a proper VS-addin project (I believe it was called). Then, with the next version of VS, all this changed again, with a reintroduction of macros. However, then MS decided to disable features necissary for me to develop this further.

These issues, together with a growing frustration about windows in general, has made leave that world behind. Thus i develop only on Linux these days.

If someone is willing to develop this further, perhaps as a github project, get in touch with me, and I can donate a little bit of time to share my experiences with this in getting you started. Contact me by email, through the service here at FEX.

Igor

Igor (view profile)

Great idea!

Any chance, that newer VS versions would be supported?

Stefan Karlsson

@Calum

Sorry for the late reply. You probably have a setting for building 32 bit applications by default, even though you are on 64 bit system.

If i remember correctly, then VS2010 comes shipped with two different versions of the debugger, one for 64, one for 32 bit.

I wont help you out unfortunately, because I no longer have a single computer with Windows, nor will I ever have one again. Best, Stefan

Calum

Calum (view profile)

This looks great. Unfortunately I get an error using the Debug function on 64 bit OS, any ideas? I'm using VS 2010 and Matlab 2013b, Windows 7 64 bit.

"The 32-bit version of Visual Studio Remote Debugging Monitor (MSVSMON.EXE) cannot be used to debug 64-bit processes"

Stefan Karlsson

@jim

Thanks for your interest, and for sharing how you solved the issue. Sounds like it is a question of varying security settings, and thus nothing that I can do anything about. Great that the solution is so simple.

To reiterate:

Tools->Options->Addin/Macros Security

add the full path of the "Matlab Tools20xx.vsix" file.

Jim

Jim (view profile)

I use Matlab R2014B 64bit and VS2010 Pro under Windows XP Pro 64bit (SP2).

After following your instructions I had a slight difficulty in using the vsix plugin;
'View' worked ok, but the other commands 'Run','RunFast' and 'Debug' all reported 'No process is associated with this object'.

To fix this I needed to explicitly 'Add' the path to the 'vsix' plugin file to VisualStudio Tools->Options->Addin/Macros Security.

thanks

Stefan Karlsson

Thomas,

Thanks for your feedback. As this submission is all about avoiding boring stuff... I dont expect many people to give a rating or feedback on this submission.

Hope you find it useful, happy coding!

Thomas Clark

Used the VS2012 extension.

Works seamlessly, thank you very much.

It took me a long time to figure out how to do this for IFC on Linux, I wasn't relishing the process of working out the same thing on VS2012 for an entirely different platform!

Updates

1.7

Just changed the description to include VS 2012, which is fully supported

1.6

updated the video tutorial

1.5

There is now a visual studio extension, instead of just Macros. Simple click install for both VS 2010 and 2012

1.2

1. Added a macro "CompileWMatlab", which only compiles and builds the code in matlab.
2. Added remarks at the top of the VB file that details how to install the macros.
3. tidied up the example mex files

1.3

Quick Fix previous upload.

1.4

- Only one open session of the thin matlab in the background.
- Added save check of current document

1.1

Added the link to the videos

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video