Reloading externals

    Feb 21 2012 | 9:26 pm
    Hi, is it possible to force Max to reload an external from disk? Having to close and restart Max just to try a different compile of an external under development is extremely annoying. Any help is very much appreciated.

    • Feb 22 2012 | 9:00 am
      So in other words: no. A Max setting to reload externals properly when possible would be really nice and save developers heaploads of time, but that sounds like the kind of thing that will never happen.
    • Apr 12 2017 | 7:24 pm
      This is a workaround that avoids restarting Max. You will have to create a new object in Max though. What I do is generate an ending based on the number of seconds since 1970 and append it to the object name.
      Assuming you're using xcode to build and your object is called "myobj~", make a bash script ""
      file_suffix=$(date "+%s")
      xcodebuild -project myobj~.xcodeproj/ \
      cp -r build/Development/myobj~.mxo build/Development/myobj~$file_suffix.mxo
      echo "wrote to myobj~$file_suffix"
      Then you can run the script by doing
      # only need to do the first time to make the script executable
      $chmod u+x ./
      # run this every time to build after changing the file
      Then in the source file "myobj~.c" you have to append the generated ending to the object name registered with max
      void ext_main(void *r)
          t_class *c = class_new("myobj~" MAX_OBJ_NAME_SUFFIX, (method)myobj_new, (method)dsp_free, (long)sizeof(t_myobj), 0L, A_GIMME, 0);
      After building your object, the script will say
      "wrote to myobj~12345678" (or some othernumber)
      use this number to create an object in Max (assuming where the object has been placed is in Max's search path). You won't need to restart Max for it to see the changes to the file.
      For production builds just set file_suffix to nothing
      in the script.