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
    • Register
    • Login

    Strange issue: Plugin not loading

    Cinema 4D SDK
    4
    10
    2.8k
    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

      Hi all!
      I am working with a colleague on a plugin that was recently ported to R20, and have encountered an issue. The plugin works fine on my colleagues machine, but when I compile it on my computer it fails to load in c4d without any warnings or errors. The plugin uses the classic API, and through testing I have concluded that "PluginStart" is never called. Here is what I did to debug this so far:

      -I copied the compiled dll from my colleague, that worked on his computer.
      -I placed these in a separate folder containing only our plugin and the c4d sdk plugins (built from the same solution).
      -In the c4d preferences, I set this folder as the only plugin folder, so that no other plugins are loaded.

      In this test, the c4d sdk plugins load fine, but our plugin does not. This is indicates to me that the plugin folder is setup correctly, and the problem actually is with our plugin. But this is the same dll that loads fine on my colleagues computer!

      I realize that this is a very vague problem description, but any suggestions on what might be causing a similar issue is warmly welcome!

      Best regards
      /Filip

      1 Reply Last reply Reply Quote 0
      • M
        mp5gosu
        last edited by

        I assume, you are using different versions. Check, that you both use the very same SDK version that comes with any C4D installation/update.

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

          Thanks mp5gosu,
          We are both on R20, but it's quite possible that we are on different minor versions. I will check.

          I have understood that from R20 and on, compiled plugins will not be compatible across releases, but I assumed that this only applied to major releases. Are you saying that compiled plugins are not even compatible between minor releases?

          (As I wrote in my original post, the c4d sdk plugins work fine, it is only our plugin that does not load)

          /Filip

          1 Reply Last reply Reply Quote 0
          • M
            mp5gosu
            last edited by

            Ah, I somehow overrad that the cinema4dsdk worked.
            I'm actually out of ideas here.

            And yes, it cann occur that plugins compiled with higher version than the one the plugin is installed to won't work at all.

            1 Reply Last reply Reply Quote 0
            • fwilleke80F
              fwilleke80
              last edited by fwilleke80

              Maybe it's just the classic "Open user folder, go into subfolder "prefs" and delete file "directorycache" before starting Cinema 4D" ?

              www.frankwilleke.de
              Only asking personal code questions here.

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

                Hi FilipM, thanks for reaching out us.

                With regard to the plugin not loading you should ensure that:

                • the plugin is compiled against R20 SP1 in order to be loaded in following R20 minor revisions;
                • the .res folder had to be properly present in your plugin folder otherwise g_resource.Init() will silently fail and you plugin won't be loaded.

                Looking forward further comments, give best.
                Riccardo

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

                  Thanks a lot for the input everybody! None of these things appear to solve my problem, so I am now investigating more closely if this is something specific to our plugin code. I'll post here again if I come up with a solution.

                  /Filip

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

                    OK; I seem to have pinpointed the problem to the use of an external library. I created a minimal example plugin that recreates the problem. Including the header file for the external library does not cause any problem, but as soon as I actually create an instance of a class defined in this header in my code, my plugin will stop loading (although everything compiles just fine).

                    The external library is essential to my plugin, so I can't work around this. In previous versions of c4d (pre-R20) I have used this external library a lot without problems.

                    Is there anything special I should look out for here? Is it possible,for example, that the source processor does anything to the headers of the external library when I include them? (My understanding of the role of the source processor is still a little shallow).

                    Thanks
                    /Filip

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

                      I have identified the issue: My plugin could not find/load the dll containing the implementation of the external library. If I place a copy of this dll in <myplugin>\res\libs\win64 then my plugin loads correctly in c4d and is able to call the 3rd party external library.

                      I found the information about where to place external libs here: https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_plugin_dev.html#page_maxonapi_plugin_dev_dependencies_dependencies

                      In the case of my plugin, however, this solution is not quite satisfactory. It is a large project consisting of several c4d plugins, each dependent on the 3rd party external library. With this solution, I would have to place a copy of the dll in each plugin folder- The dll is quite large (it's a renderer!) so this would bloat my plugin significantly.

                      Is there any way of telling a c4d plugin to look for dll:s in a specificed directory? (And, as a secondary question: Previously, it was enough to add the dll directory to the PATH environment variable. Is there a good reason why this behaviour was changed?)

                      /Filip

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

                        This has deviated a bit from the original question, so I will mark this as solved and open a new thread with the remaining questions.

                        Thanks for the input everybody!

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