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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    using 32/64 bit DLL's paths

    SDK Help
    0
    6
    479
    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
      Helper
      last edited by

      On 01/02/2013 at 16:34, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi guys,
      my plugin uses some dlls, only can find when i put them to main application folder.
      But i have 32/64 bits of dlls. i want to put thems to libs32/libs64 folders under my plugin directory. 
      How can point accordingly which and where is the correct dll while my plugin is loading?

      Best regards

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

        On 05/02/2013 at 02:50, xxxxxxxx wrote:

        Hi,

        Have you considered compiling the library into your plugin binary?

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

          On 05/02/2013 at 04:47, xxxxxxxx wrote:

          - First of all you probably want to load them with the full, absolute path, because that is just the easiest, most stress free way to do it.
          You can get the full path to you plugin from C4D (GeGetPluginPath()), just append the libs32/libs64 folder depening on bitness and add the dll name.

          (Another way would be to add the dll directory to the search paths (where Windows will look for DLLs). This can be useful if you DLL depends on other DLLs.)

          - You probably want to use LoadLibraryW or LoadLibraryExW (W stads for "wide", Windows uses some kind of UTF-16 as platfrom encoding) - otherwise non ASCII characters *will* cause problems at some point in the future.

          - When using LoadLibraryW/LoadLibraryExW make sure you *properly* convert the strings to platform encoding. Ask C4D for the UTF-8 String (you can specify the encoding in most String functions) and then use MultiByteToWideChar (Windows API function) to convert it to UTF-16. You should be able to find example code somewhere on the internet.

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

            On 05/02/2013 at 04:50, xxxxxxxx wrote:

            Hi, this is not so easy but there are several ways to that. First solution as Yannick already mentioned is to compile the library as a static one in your binary.

            1. Tell the OS where it can find further DLLs. E.g. on Windows you can do this with the environment variables but for a customer this might be a dealbreaker.

            2. Don't make a direct dependency to the DLL and load it dynamically with LoadLibrary(). Then you can extract the functions. In that case you can put the DLL wherever you want.

            3. Put the DLL in /resource/libs/win(32/64). C4D registers that folder on startup and when your plugin will be loaded C4D will load the DLL from there.

            Cheers, Sebastian

            Edit: fused was faster 🙂

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

              On 05/02/2013 at 09:09, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              1. Put the DLL in /resource/libs/win(32/64). C4D registers that folder on startup and when your plugin will be loaded C4D will load the DLL from there.

              That's good to know 🙂

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

                On 05/02/2013 at 14:52, xxxxxxxx wrote:

                thanks for your helps. I'll try and report.
                I used actually delayed dll loading, and after start the plugin which copy dll's to main folder. But it's not good way i think.

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