Debugging with MaxRT using search paths

hardcoder's icon

Hi forum,

I just wrote an C-external in MAX MSP 6 and want to debug it. Apparently, this cannot be done with Max.exe, so I use MaxRT.exe instead. This works fine, if I only debug this one .mxe file.

The problem:

My external needs different helper objects, which care about the calculation of internal module parameters of my external. But these helper objects are not in the same folder as the external.

How can I add searchpaths using MaxRT.exe without having to put all files into one folder? Or is there a way to use Max.exe for debugging?

hardcoder's icon

I found a workaround for this problem. I wrote a script, which copies all files in my max working directory recursively to a Debug folder. This script is executed as a pre-build event. As a post-build event, the mxe file is copied to the same folder.

hardcoder's icon
::------------------------------------------------------------------------------
:: file:   bundle_max_files.bat
:: author: hardcoder
:: date:   2014-03-03
:: info:   Recursiveley get all files of a specified search folder, and copy to 
::         one target folder. Useful, when debugging Max externals with MaxRT.exe, 
::         which does not have the option to specify search pathes. Execute this
::         file as prebuilt event in Visual Studio and also copy the output 
::         external file to targetDir created by this script.
:: note:   svn files are not copied.
::------------------------------------------------------------------------------

@echo off

:: go to location of this script
cd %0\.. 

echo ======================================
echo Bundle max files for Debug ...
echo ======================================

setlocal enabledelayedexpansion

set targetDir=max_Debug
set searchDir=..\..\..\max_workspace

:: remove quotes
set targetDir=!targetDir:"=!
set searchDir=!searchDir:"=!

if not exist "%targetDir%" (
    md "%targetDir%"
) else (
    del /q "%targetDir%\*" 2>NUL
)

FOR /F "tokens=*" %%f IN ('dir %searchDir% /A:-D /B /S ^| findstr /V /I "\\.svn\\"') DO (
    set existingFileName=%%f
    set newFileName=%targetDir%\%%~nf%%~xf
    copy "!existingFileName!" "!newFileName!" >NUL
)
endlocal