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

    Plugin does not appear in Expression on client's Cinema 4D

    Cinema 4D SDK
    s26 2024 c++ windows
    3
    24
    3.6k
    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.
    • Y
      yaya
      last edited by

      Actually I am not fully correct: the plugin now does not loading in C4D r23 and C4D 2024. But still appears in C4D 2025 😄
      Frustrating...

      https://www.ragdollplugin.com

      1 Reply Last reply Reply Quote 0
      • H
        Havremunken
        last edited by Havremunken

        One thing you could do is run a utility like procmon: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

        This will let you see what a process accesses on the file system, among other things. Hopefully it will also show you which paths are searched for these libraries, allowing you to identify how to get them in the right location for your customer. 🙂

        ferdinandF 1 Reply Last reply Reply Quote 1
        • ferdinandF
          ferdinand @Havremunken
          last edited by

          Hey @yaya,

          When it still works, you likely missed some files somewhere. In the end you yourself can only untangle this, as we have no idea what you did there. I had a brief look at the main lib-curl project (there are many-many deviations), and what stands out, is that you also seem to have linked against the wrong library, at least judging by the main project.

          [...] Could not load libcurl.dll due to Windows System Error #126 [...] 
          

          64 bit curl:
          70e8f33e-8eb7-4037-b7e2-a7161e534ef1-image.png
          32 bit curl:
          70d376f4-cea6-4642-b9ac-ca5037b1fb1c-image.png

          I.e., you seem to have linked against 32 bit curl, at least when judging by the name. This should not work in the first place, as Cinema 4D is a 64bit app, it cannot link against 32 bit DLLs (without getting very creative). What @Havremunken said would be the next logical step, use some of the debugging tools that come with Visual Studio. But it is of course not so good when you have to start reverse engineering your own app like that.

          I assume you are all testing this on your development machine? I would recommend testing this on another machine, where you can be sure that it has not been 'tainted' with libcurl and other library fragments. When it still loads for you on such vanilla machine for you, than you have a real mystery on your hand, and have to start digging around deeper with some debug tools, to not only see what is failing (e.g., what is printed in the -g_console) but also which DLL access might succeed.

          Cheers,
          Ferdinand

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 1
          • Y
            yaya
            last edited by yaya

            I've managed to reproduce the problem: the Cinema does not load the plugin (r23 and 2025).
            To do it, I not only deleted libcurl.dll, libcrypto-3-x64.dll, libcurl-d.dll from Windows/System32. It was enough for r23. For 2025 I was needed also to delete the variable from a PATH to Windows/System32.
            Then I've tried to build the static lib of curl. I was thinking that this way will be better. I will not explain all the details, but it didn't - it just finished every build with:

            1>LINK : fatal error LNK1104: cannot open file 'curl/libcurl_a_debug.lib'.
            

            And nothing helped to fix that.
            So I decided to return to the dynamic libraries. Actually I do not mind to supply the above dlls with my plugin.
            I have reverted the binding to the dynamic version of curl and openSSL. Also I have added libcurl.dll, libcrypto-3-x64.dll, libcurl-d.dll to *plugin root/res/libs (not so hoping plugin will start to take them from there).
            And I've delete the variable from a PATH (Windows/System32) to make sure it won't catch on these dlls from the System32.
            Now I am making the build and it finishes with the success. And when I am starting the r23 - of course there is no plugin.
            Yes, -g_console says:

            WARNING: Error loading file:///H:/Code/r23/sdk/plugins/firstplugin/ragdoll.xdl64: Could not load dll because of
              Could not load libcrypto-3-x64.dll due to Windows System Error #126: The specified module could not be found. [win_dll.cpp(304)].
              Could not load libcurl-d.dll due to Windows System Error #126: The specified module could not be found. [win_dll.cpp(304)].. (file:///H:/Code/r23/sdk/plugins/firstplugin/ragdoll.xdl64) [win_dll.cpp(324)]
              Cause: Windows System Error #126: The specified module could not be found. [win_dll.cpp(318)] [general.cpp(401)]
            

            Expected. The same problem which clients have.
            (And yes, if I will back libcurl.dll, libcrypto-3-x64.dll, libcurl-d.dll to the System32, then my plugin appears in Expression)

            So right now I need somehow to fix it so the plugin catch on libcurl.dll, libcrypto-3-x64.dll, libcurl-d.dll not from my Windows/System32 but from *res/libs.

            How to do it?
            DeepSeek gives me a hint that I can use

            void SetDllSearchPath() {
                // Set the DLL search path to the res/libs folder
                SetDllDirectory(L"res\\libs");
            }
            
            // Call this function during plugin initialization
            SetDllSearchPath();
            

            But I am not sure is it right?
            If it is not, then how to achieve this with maybe the other correct way?

            https://www.ragdollplugin.com

            ferdinandF 1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand @yaya
              last edited by ferdinand

              Hey @yaya,

              good to see that you made progress. To link against a static library, you can either set the respective Visual Studio module properties manually (not recommended) or set the relevant arguments in the projectdefitnion.txt of your module. For what you are doing, this could look something like this (for Windows), assuming curl would be situated in your project root, i.e., two folders "up".

              AdditionalLibraryDirectories.Win64.Debug  =../../curl/bin/
              AdditionalDependencies.Win64.Debug =libcurl_a_debug.lib
              AdditionalIncludeDirectories=../../curl/include
              

              FYI, you should not ship plugins using debug libraries, as they tend to be much-much slower than release code, due to all the debug symbols and other crap floating around in them, causing performance penalties of 10x, 20x, or even more.

              Cheers,
              Ferdinand

              MAXON SDK Specialist
              developers.maxon.net

              Y 1 Reply Last reply Reply Quote 0
              • Y
                yaya @ferdinand
                last edited by yaya

                @ferdinand Yes, I will not ship the debug version of dlls. It is just for testing.
                But are you sure that your that you wrote me right? Your hint is about the linking of static library but libcurl_a_debug.lib does not work for me.
                Or did you mean that if I do as you described above it, the error 1>LINK : fatal error LNK1104: cannot open file 'curl/libcurl_a_debug.lib'. - will disappear? Then thank you about this solution, in this case I will need to get back again to a static library (which I already have deleted 😄 )
                But what about the linking dlls to make libcurl.dll, libcrypto-3-x64.dll, libcurl-d.dll linked from res/libs during Cinema 4D startup (and for shipping first two to clients)? Is there some option for this?

                https://www.ragdollplugin.com

                ferdinandF 1 Reply Last reply Reply Quote 0
                • ferdinandF
                  ferdinand @yaya
                  last edited by ferdinand

                  Well, I answered this:

                  1>LINK : fatal error LNK1104: cannot open file 'curl/libcurl_a_debug.lib'.

                  Which is a linker error (the static linker at compile time), where the linker cannot find the static library (libcurl_a_debug.lib) to link against. I am quite frankly a bit in the unclear what you are trying to do exactly, use the statically or the dynamically linked version of your libraries. When you "just" want to load a DLL under Windows, you could do something like this:

                  #include <windows.h>
                  #include <iostream>
                  
                  typedef void (*MyFunctionType)();
                  
                  int main() {
                      // Load the DLL
                      HMODULE hModule = LoadLibrary(L"MyLibrary.dll");
                      if (!hModule) {
                          std::cerr << "Failed to load MyLibrary.dll" << std::endl;
                          return 1;
                      }
                  
                      // Get the function address
                      MyFunctionType MyFunction = (MyFunctionType)GetProcAddress(hModule, "MyFunction");
                      if (!MyFunction) {
                          std::cerr << "Failed to get the function address" << std::endl;
                          FreeLibrary(hModule);
                          return 1;
                      }
                  
                      // Call the function
                      MyFunction();
                  
                      // Free the DLL
                      FreeLibrary(hModule);
                  
                      return 0;
                  }
                  

                  But doing all this low-level boilerplate code poking around has become somewhat unfashionable. And Visual Studio DLL projects or third party libraries usually offer two files when creating/shipping shared libraries. The actual shared library, e.g., MyLibrary.dll, and a static library file MyLibrary.lib which does not hold a static version of the library but the boilerplate code to correctly load that shared library at runtime and align the function/type pointers with symbols.

                  So, even when you dynamically link against a shared library at runtime, you often link statically against a library at compile time, which takes care of the runtime boilerplate code for you. What is the case for the libraries you used there, I have no idea. The settings in the projectdefinition.txt are just for static linking, as linkers/compilers do not care about dynamic linking.

                  Cheers,
                  Ferdinand

                  MAXON SDK Specialist
                  developers.maxon.net

                  Y 1 Reply Last reply Reply Quote 0
                  • Y
                    yaya @ferdinand
                    last edited by yaya

                    @ferdinand thank you for you answer.
                    I was thinking that:

                    • if at the beginning (when I just started to add the curl and openSSL to a code) the code in the VS 2019 worked fine. But after making a build the plugin does not loaded in Cinema, throwing an error about missing dlls.

                    But, if I managed to fix it just via:

                    • adding few dlls (libcurl.dll, libcrypto-3-x64.dll, libcurl-d.dll)
                    • to Windows/System32 and by editing system variables...

                    ...But in this case the plugin does not work on the client's side, because of:

                    • clients do not have that dlls on their side,

                    Then:

                    • I can "simply" make the plugin work on the client's side just (somehow) adding missing dlls => to a plugin's res/libs and shipping them with the plugin.

                    I was thinking it is easy to do. But if you say that it is not (or as I understand), then I will try your solution. Which seems harder for me because my lack of knowledges.
                    F.e. I did not understood how to set up an exact path in the projectdefitnion.txt via that command. If f.e. I have this text in the projectdefitnion.txt:

                    Platform=Win64;OSX
                    Type=Solution
                    Solution=\
                    	plugins/cinema4dsdk;\
                    	plugins/maxonsdk.module;\
                    	plugins/microsdk;\
                    	plugins/ragdoll
                    

                    where the last line means the root folder of my plugin.
                    And if I need to include "curl" folder via your line:

                    AdditionalLibraryDirectories.Win64.Debug  =../../curl
                    AdditionalDependencies.Win64.Debug =libcurl_a_debug.lib
                    AdditionalIncludeDirectories=../../curl
                    

                    where "curl" is a folder exactly in "ragdoll" and the "libcurl_a_debug.lib" is a file directly in the "curl"
                    So how to edit the line accordingly? I mean all that "../..." :

                    AdditionalLibraryDirectories.Win64.Debug  =../../curl
                    

                    https://www.ragdollplugin.com

                    ferdinandF 1 Reply Last reply Reply Quote 0
                    • ferdinandF
                      ferdinand @yaya
                      last edited by ferdinand

                      This:

                      Platform=Win64;OSX
                      Type=Solution
                      Solution=\
                      	plugins/cinema4dsdk;\
                      	plugins/maxonsdk.module;\
                      	plugins/microsdk;\
                      	plugins/ragdoll
                      

                      is the projectdefitnion.txt of your solution, i.e., the build config which links all modules together. You must use plugins/ragdoll/project/projectdefitnion.txt instead, it is the build config for that module. Think of it as the CMakeLists.txt of that module when you are familiar with CMake. After these changes you must regenerate your project with the project tool.

                      I quite frankly do not understand your solution, but as always, whatever works, works. So, if it does work for you, I am happy.

                      The ".." in paths is common relative path syntax and means one folder up (in relation to the module). So, ../../foo means a foo folder in the root of your project.

                      root
                        foo
                        plugins
                          ragdoll
                      

                      Cheers,
                      Ferdinand

                      MAXON SDK Specialist
                      developers.maxon.net

                      1 Reply Last reply Reply Quote 0
                      • Y
                        yaya
                        last edited by

                        I know what is projectdefitnion.txt. I just do not understand how to use the line: AdditionalLibraryDirectories.Win64.Debug =../../curl 🙂
                        And do I need to launch again the buildsdk23.bat right after each time I change this file.
                        I have not added the static curl library in my project yet.

                        https://www.ragdollplugin.com

                        1 Reply Last reply Reply Quote 0
                        • ferdinandF
                          ferdinand
                          last edited by ferdinand

                          Well, you apparently do not, because you showed us the wrong projectdefitnion.txt file above, putting the command there won't work as I tried to explain 😉 And yes, you must regen your project after such changes, which I assume is what you mean with buildsdk23.bat.

                          MAXON SDK Specialist
                          developers.maxon.net

                          1 Reply Last reply Reply Quote 0
                          • Y
                            yaya
                            last edited by

                            Oh, you've edited your previous message! Thanks! I will try it.

                            https://www.ragdollplugin.com

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