Building from Source

The latest sources of Visual D are available from the SVN repository at http://svn.dsource.org/projects/visuald/trunk or from github at https://github.com/rainers/visuald.

Prerequisites

You need the following tools to build Visual D:

Building Visual D

The Visual D source code is usually updated to work with the latest release version of DMD (2.059 as of now), so you should use this release of the compiler when using the latest svn/git checkout.

The standard build procedure for the release version is to execute "nmake" in the trunk directory. Please check the variable settings at the top of the Makefile and adjust them to the installation directories on your system.

If you want to start developing or debugging, you should execute "nmake sdk" at least once to build the necessary D translations from the Windows and Visual Studio SDK. Afterwards you can use Visual D itself with the solution visuald_vs9.sln or visuald_vs10.sln, respectively.

Known issues

  • building the parser library with stock DMD causes an "Out of memory" error. There are two options how to fix this:
    • enable the LARGE_ADDRESS_AWARE bit inside dmd.exe with this simple tool: http://www.dsource.org/projects/visuald/browser/trunk/tools/largeadr.d (if you are running a 32-bit OS, you will also need to boot with the /3GB switch)
    • build DMD with the Microsoft compiler instead of the Digital Mars compiler (This also has the benefit of an executable that compiles about twice as fast)
  • building pkgcmd.cto from pkgcmd.ctc needs CTC.exe from the VS2008 VSI SDK. This program is no longer available in the 2010 VSI SDK. Therefore, a precompiled version of pkgcmd.cto is committed. If the build rule fails please make sure pkgcmd.cto is newer than pkgcmd.ctc to skip this build step.
  • A druntime patch is necessary for correct name demangling in the profiler window:
    • Issue 4852: Support to suppress function signature in the profiler window

Compiling Visual D without this patch is still possible, the compiler will detect it and use compatibility code emitting messages to that respect.

Deployment

You should debug the plugin within Visual Studio 2008/2010 using a different branch in the registry, so it does not interfere with your working environment.

- VS2008: To create a configuration named "D"

  • As administrator, execute from the command line:

<path-to-visual-studio-sdk>\VisualStudioIntegration\Tools\Bin\VSRegEx.exe getorig 9.0 D

  • and register the compiled debug plugin with

trunk\nsis\register.bat.

  • The IDE can then be started with the new settings branch via

devenv /RootSuffix D

- VS2010: The mechanism has dramatically changed with VS2010, as the non-standard registry settings are rebuilt on every start of Visual Studio.

  • Put the files from trunk\nsis\extensions into the folder $(APPDATA)\Local\Microsoft\VisualStudio\10.0D\Extensions\VisualD
  • in visuald.pkgdef, replace the path "M:\\s\\d\\visuald\\trunk\\bin\\debug\\visuald.dll" with your debug build output path.
  • Start the IDE with the new settings branch via

devenv /RootSuffix D

  • Visual D will now be shown in the Extension Manager where it has to be enabled.

Good luck!

Building earlier versions of Visual D

Earlier versions of Visual D were built with DMD 2.051 or earlier. Unfortunately, there are some patches necessary to DMD and the D runtime library for compilation.

The full patch to the DMD release 2.049 can be found in the patches directory of the svn tree. The dmc compiler is needed to compile dmd and the library.

  • Copy the files buildall.bat, patchd.d and dmd_2_049.patch into the unmodified src directory of the dmd-installation.
  • Check the path settings at the top of buildall.bat. Especially check the DMCPATH that must point to the bin directory of the dmc installation.
  • Running buildall.bat patches dmd, builds the compiler and the runtime library and copies everything into the proper installation directories.
  • The patch file will be renamed to *.applied, so it won't be applied again. You can execute buildall.bat to build dmd and the library again.

Patches

Just for reference, here are some (but not all) of the changes contained in the patch:

  • Issue 4069 std.xml.Document.pretty saves empty elements with spaces and line breaks
  • Issue 4092 broken memory management for COM objects derived from IUnknown

Fixed in DMD 2.047:

  • Issue 3200 std.xml doesn't follow spec for Tag.text

Fixed in DMD 2.046:

  • Issue 4015 forward reference in alias causes error

Fixed in DMD 2.044: