Dynamically load plugin by C4D-version



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/11/2008 at 01:54, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R9.6+ 
    Platform:   Windows  ; Mac  ;  
    Language(s) :     C++  ;

    ---------
    Hi,

    our plugin uses some new/changed API parts of R11 so we need to distribute different plugins for R9/10 and R11.

    Two plugins (plug.cdl and plug11.cdl) are being created each compiled with corresp. API. Both have the same plugin id and both are distributed.

    Using the code snippet below the corresponding plugin file is loaded dynamically depending on the current C4D version:

    > \> Bool PluginStart(void) \> { \> #if API_VERSION >= 11000 \>      if(GetC4DVersion() >= 11000) \>      { \>           GePrint("r11"); \>           RegisterPlugin(); \>      } \> #endif \> #if API_VERSION < 11000 \>      if(GetC4DVersion() < 11000) \>      { \>           GePrint("r10"); \>           RegisterPlugin(); \>      } \> #endif \>      return TRUE; \> } \>

    This way, although there are 2 plugins with the same id only one is registered depending on the currently running C4D version (r9/10 is skipping the r11 cdl and r11 is skipping the other one). I admit this may be kind of a rude approach. It works perfectly well on Win PCs though.

    The Mac version causes the following troubles:
    in R10 c4d tries to register the R10 plug.dylib TWICE, thus causing a plugin id conflict. Interestingly the console says "r10" twice too so for BOTH plugins the API_VERSION seems to be the same although clearly compiled with a different library;
    in R11 NO plugin is registered at all.

    As far as I have read there are no differences concerning API_VERSION or GetC4DVersion() between pc and mac.

    Any clue about the reason of this would be appreciated,

    -Andre


Log in to reply