Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Specify additional directories for DLL dependencies

    Cinema 4D SDK
    2
    3
    746
    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.
    • F
      FilipM
      last edited by FilipM

      Hi!
      My plugin depends on a 3rd party external library in the form of a DLL. According to the docs, additional DLLs needed by a plugin can be placed in myplugin\res\libs\win64. (https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_dev_windows.html#page_maxonapi_dev_windows_practice_dll).

      For my plugin, this is not a very convenient solution. The DLL in question is already installed in a specific location, which is added to the PATH environment variable by the installer of the 3rd party library. Also, my plugin project actually consists of several c4d plugins which each need to communicate with the same copy of the DLL. My workaround solution for now is to simply place the DLL in the same directory as the c4d executable. This works, but is not very elegant.

      So: Is there any way to specify a custom directory where my plugins will look for additional dynamic libraries? This was possible in previous versions of c4d (using the standard PATH environment variable) so I am really hoping it is possible in R20 as well.

      Thanks
      /Filip

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi FilipM, thanks for reaching out us.

        With regard to your request, unfortunately there are no official options than the recommendation you've already found in the documentation.
        The idea of having the dynamic library being contained in a folder under the plugin itself was actually driven by the need to grant plugins to be installed everywhere also by non-elevated users. This approach should grant plugins to access the dynamic libraries they were supposed to load without hassles.

        Although on Linux-derived OS there's still the chance to use the rpath mechanism to refer to an environment variable defining where dynamic libraries should be searched, on Windows this is not possible.

        Finally with regard to your plugin project (let's call it MyPluginProject) where multiple Cinema 4D plugins (MyPlugin01, MyPlugin02, MyPlugin0x) are accessing the same libraries, rather to go for

        <c4d>
          |-plugins
              |-MyPlugin01
                  |-MyPlugin01.xdl64
              |-MyPlugin02
                  |-MyPlugin02.xdl64
        ...
        ...
              |-MyPlugin0x
                  |-MyPlugin0x.xdl64
        

        to consider something like

        <c4d>
          |-plugins
              |-MyPluginProject
              |-MyPlugin01.xdl64
              |-MyPlugin02.xdl64
        ...
        ...
              |-MyPlugin0x.xdl64
        

        If I end up with some workaround I'll come back here but for the time being I consider it solved.

        Best, Riccardo

        1 Reply Last reply Reply Quote 1
        • F
          FilipM
          last edited by

          @r_gigante said in Specify additional directories for DLL dependencies:

          If I end up with some workaround I'll come back here but for the time being I consider it solved.

          OK, thanks for the info!

          /Filip

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