Max SDK version check


    Dec 04 2008 | 12:06 am
    Hi all, i just tried some things with the Max5 SDK and found that it breaks some of my existing code because of clashes with some newly defined types (like t_clock). Is there are way to cleanly check for the SDK version? I couldn't find any kind of SDK version preprocessor symbol...
    The new SDK reference is great. However, it would be nice to have a way to search for function names. That currently doesn't some to be possible.
    gr~~~

    • Dec 05 2008 | 7:13 am
      Hi Thomas,
      While the logical thing would to have the version as a preprocessor symbol there is actually (at the expense of a function call) a global function, short maxversion(void); -- this will return the version of Max in either hex or decimal format. Here are the comments, and function on line 2041 of ext_proto.h:
      /** Determine version information about the current Max environment.
      This function returns the version number of Max. In Max versions 2.1.4 and later, this number is the version number of the Max kernel application in binary-coded decimal. Thus, 2.1.4 would return 214 hex or 532 decimal. Version 3.0 returns 300 hex.
      Use this to check for the existence of particular function macros that are only present in more recent Max versions. Versions before 2.1.4 returned 1, except for versions 2.1.1 - 2.1.3 which returned 2.
      Bit 14 (counting from left) will be set if Max is running as a standalone application, so you should mask the lower 12 bits to get the version number.
      @ingroup misc @return The Max environment's version number. */ short maxversion(void);
      hope this solves your problem, should be only necessary to call once.
      -=brandon=-
      On Wed, Dec 3, 2008 at 4:06 PM, Thomas Grill wrote: > Hi all, > i just tried some things with the Max5 SDK and found that it breaks some of > my existing code because of clashes with some newly defined types (like > t_clock). > Is there are way to cleanly check for the SDK version? I couldn't find any > kind of SDK version preprocessor symbol... > > The new SDK reference is great. However, it would be nice to have a way to > search for function names. That currently doesn't some to be possible. > > gr~~~ > >
    • Dec 05 2008 | 7:17 pm
      Hi Brandon, thanks for your feedback. Since i'm having compile time troubles, a function call won't help me. There really _should_ be a preprocessor symbol for the SDK version. gr~~~
      Am 05.12.2008 um 08:13 schrieb Brandon Nickell:
      > Hi Thomas, > > While the logical thing would to have the version as a preprocessor > symbol there is actually (at the expense of a function call) a global > function, short maxversion(void); -- this will return the version of > Max in either hex or decimal format. Here are the comments, and > function on line 2041 of ext_proto.h: > > /** > Determine version information about the current Max environment. > > This function returns the version number of Max. In Max versions > 2.1.4 and later, this number is the version number of the Max kernel > application in binary-coded decimal. Thus, 2.1.4 would return 214 hex > or 532 decimal. Version 3.0 returns 300 hex. > > Use this to check for the existence of particular function macros > that are only present in more > recent Max versions. Versions before 2.1.4 returned 1, except for > versions 2.1.1 - 2.1.3 which returned 2. > > Bit 14 (counting from left) will > be set if Max is running as a standalone application, so you should > mask the lower 12 bits to get the version number. > > @ingroup misc > @return The Max environment's version number. > */ > short maxversion(void); > > hope this solves your problem, should be only necessary to call once. > > -=brandon=- > > On Wed, Dec 3, 2008 at 4:06 PM, Thomas Grill wrote: >> Hi all, >> i just tried some things with the Max5 SDK and found that it >> breaks some of >> my existing code because of clashes with some newly defined types >> (like >> t_clock). >> Is there are way to cleanly check for the SDK version? I couldn't >> find any >> kind of SDK version preprocessor symbol... >> >> The new SDK reference is great. However, it would be nice to have >> a way to >> search for function names. That currently doesn't some to be >> possible. >> >> gr~~~ >> >>
    • Dec 05 2008 | 10:20 pm
      Quote: gr@grrrr.org wrote on Fri, 05 December 2008 20:17 ---------------------------------------------------- Since i'm having compile time troubles, a > function call won't help me. > There really _should_ be a preprocessor symbol for the SDK version. > gr~~~ ----------------------------------------------------
      I have been muttering about this for almost ten years.
      What I have found is that you can kludge something together by looking at other preprocessor symbols the Max SDK defines. I don't have the Max5 SDK installed on this machine, but if you diff the 4.63 and 5.0 ext.h files, for instance, you will probably find some useful identifier that you can conditionally compile off.
      With this particular problem I've been lucky, because I use a different convention for naming type (eg tMyType, ie, no underscore but intercaps). Since David and Joshua seem to love underscores, if you globally change your code to use an underscore-free naming convention, you'll probably be safe for all eternity (as well as guaranteeing backwards-compatibility).
      HtH -- P.
    • Dec 05 2008 | 10:22 pm
      BTW, can we make an official request to add a preprocessor symbol identifying the SDK version? Something like
      #define MAX_SDK_VERSION 0x0500
      in ext.h?
      Thank you for your attention,
      -- P.
    • Dec 06 2008 | 3:00 am
      Hey look at this (13,14 of commonsyms.h):
      #define COMMON_SYMBOLS_VERSION_5_0_0 500 // Max 5 #define COMMON_SYMBOLS_VERSION COMMON_SYMBOLS_VERSION_5_0_0
      This precedes the definition of the _common_symbols_table data structure -- seems reasonable to compile with commonsyms.h as all it has in there is this table.
      Awesome.
      Brandon
      On Fri, Dec 5, 2008 at 11:17 AM, Thomas Grill wrote: > Hi Brandon, > thanks for your feedback. Since i'm having compile time troubles, a function > call won't help me. > There really _should_ be a preprocessor symbol for the SDK version. > gr~~~ > > Am 05.12.2008 um 08:13 schrieb Brandon Nickell: > >> Hi Thomas, >> >> While the logical thing would to have the version as a preprocessor >> symbol there is actually (at the expense of a function call) a global >> function, short maxversion(void); -- this will return the version of >> Max in either hex or decimal format. Here are the comments, and >> function on line 2041 of ext_proto.h: >> >> /** >> Determine version information about the current Max environment. >> >> This function returns the version number of Max. In Max versions >> 2.1.4 and later, this number is the version number of the Max >> kernel >> application in binary-coded decimal. Thus, 2.1.4 would return 214 >> hex >> or 532 decimal. Version 3.0 returns 300 hex. >> >> Use this to check for the existence of particular function macros >> that are only present in more >> recent Max versions. Versions before 2.1.4 returned 1, except for >> versions 2.1.1 - 2.1.3 which returned 2. >> >> Bit 14 (counting from left) will >> be set if Max is running as a standalone application, so you should >> mask the lower 12 bits to get the version number. >> >> @ingroup misc >> @return The Max environment's version number. >> */ >> short maxversion(void); >> >> hope this solves your problem, should be only necessary to call once. >> >> -=brandon=- >> >> On Wed, Dec 3, 2008 at 4:06 PM, Thomas Grill wrote: >>> >>> Hi all, >>> i just tried some things with the Max5 SDK and found that it breaks some >>> of >>> my existing code because of clashes with some newly defined types (like >>> t_clock). >>> Is there are way to cleanly check for the SDK version? I couldn't find >>> any >>> kind of SDK version preprocessor symbol... >>> >>> The new SDK reference is great. However, it would be nice to have a way >>> to >>> search for function names. That currently doesn't some to be possible. >>> >>> gr~~~ >>> >>> > >
    • Mar 04 2010 | 1:52 pm
      BTW, can we make an official request to add a preprocessor symbol identifying the SDK version? Something like
      #define MAX_SDK_VERSION 0x0500
      in ext.h?
      Thank you for your attention,
      -- P.
      In the 5.1.1 sdk, ext.h contains :
      #define C74_MAX_SDK_VERSION 0x0508
      I think that should be corrected to 0x0511
      Ch.
    • Mar 05 2010 | 2:38 pm
      Thanks, this will be updated for the next SDK revision.