Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Dynamically load plugin by C4D-version

    Scheduled Pinned Locked Moved SDK Help
    1 Posts 0 Posters 128 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • First post
        Last post