HOWTO: building RTAS with vs2008


#1

My target: get RTAS building with static runtimes and in both debug and release.
My heroic helper: Olivier Tristan from USB (http://www.rawmaterialsoftware.com/memberlist.php?mode=viewprofile&u=426 on the forum)

The PT8.0 SDK zip file comes with 2 libraries prebuilt: DSPManagerClientLib.lib RTASCleintLib.lib. And one library which you need to build yourself: PlugInLib.lib
However, you need to rebuild all 3 libraries in vs2008 (and change some settings) to get stuff working:

* PT_80_SDK\AlturaPorts\Fic\Source\SignalNets\WinBuild
    Debug project settings:
        * Code generation > runtime library > select the NON-DLL (i.e. static) version!
        * Remove these preprocessor defines:
            _HAS_ITERATOR_DEBUGGING=0
            _SECURE_SCL=0
            
    Release project settings:
        * Code generation > runtime library > select the NON-DLL (i.e. static) version!
        * Remove these preprocessor defines:
            _SECURE_SCL=0

    -> rebuild all Debug and Release

* PT_80_SDK\AlturaPorts\TDMPlugIns\PlugInLibrary\WinBuild
    Debug project settings:
        * Code generation > runtime library > select the NON-DLL (i.e. static) version!
        * Remove these preprocessor defines:
            _HAS_ITERATOR_DEBUGGING=0
            _SECURE_SCL=0
            
    Release project settings:
        * Code generation > runtime library > select the NON-DLL (i.e. static) version!
        * Remove these preprocessor defines:
            _SECURE_SCL=0

    -> rebuild all Debug and Release
    
* PT_80_SDK\AlturaPorts\TDMPlugIns\DSPManager\Winbuild
    Debug project settings:
        * Code generation > runtime library > select the NON-DLL (i.e. static) version!
        * Remove these preprocessor defines:
            _HAS_ITERATOR_DEBUGGING=0
            _SECURE_SCL=0
            
    Release project settings:
        * Code generation > runtime library > select the NON-DLL (i.e. static) version!
        * Remove these preprocessor defines:
            _SECURE_SCL=0

    -> rebuild all Debug and Release

* Make sure that your introjucer project is also set to using static runtime libraries.

Notice that all of these libs use a calling specification of __stdcall (properties > C++ > advanced > calling convention) instead of the more used __cdecl. To circumvent this problem the introjucer uses per-file-project-settings in visual studio projects. All the RTAS wrapper files (juce_RTAS_DigiCode?.cpp, juce_RTAS_WinUtilities.cpp and juce_RTAS_Wrapper.cpp) should have a per-file-setting of calling convention __stdcall (right-click file -> properties > C++ > advanced > calling convention). When linking it is important that all the RTAS files have this calling specification or you will get linker errors. The default introjucer visual studio files have this set correctly. I just add this here so people who are NOT using the introducer and who might have read over the comments in Jules’ files will get this.

Now you need to change the RTAS wrapper in one location:

 #if JUCE_DEBUGxxx // (the debug lib in the 8.0 SDK fails to link, so we'll stick to the release one...)
  #define PT_LIB_PATH  JucePlugin_WinBag_path "\\Debug\\lib\\"
 #else
  #define PT_LIB_PATH  JucePlugin_WinBag_path "\\Release\\lib\\"
 #endif

Remove the xxx, as we WILL be able to link with the PT debug libs for the debug build. With these settings I’m able to compile without trouble in both release and debug and linking with the static runtimes.

There is still one big problem with debugging in PT9 and PT10:

[list]
[]if you launch PT-dev from within visual studio, you get an endless loop of: “Unhandled exception at 0x00000000 in ProTools.exe: 0xC0000005: Access violation.”[/]
[]if you try to attach-to PT-dev post launch (the attach works) and then alt-tab to PT, PT exists itself after about 1 second.[/][/list]

If anyone finds a way to circumvent this, let me know and I’ll add it in here.

greetings,

  • Bram

#2

Hello,

That’s great Bram !
I followed your steps and got to the point compile and link successfully a debug version of the JuceDemoPlugin !
Though the plugin is not loading in protools 3PDEV … , which says “plugin is damaged etc…”… Any idea ?

Salvator


#3

No idea salvator. For me these (debug builds) load in pt9-dev and pt10-dev, but I can’t debug anyway (so… there isn’t much of a point anyway)

  • bram

#4

Salvator, you might have problems with alignment. I see the same problem, currently. Step into the constructors of the RTAS type objects. You will eventually see the initialisation of fPluginType with a value indicating it is a host plug-in (the value is 3, I forget what the enum value is). If after assignment, you still see fPluginType with a value of 0, you might have an alignment problem.