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

    ctypes different for 32 - 64 bits

    SDK Help
    0
    2
    211
    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 12/11/2013 at 02:09, xxxxxxxx wrote:

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

      ---------
      I use ctypes to call C++ with two strings (char * ).

      Using 32 bits (+ debug) the string are received ok in C++
      Using 64 bits (no debug) the string is rubbish in C++.

      Python script (part)

          class S2H(Structure) :
              _fields_ = [("a",ctypes.c_char_p), ("b",ctypes.c_char_p)]
        
          MyLib.SetBlend.restype = int
          MyLib.SetBlend.argtypes = [S2H]
          inp = S2H("Mat.2", "456")
              
          res = MyLib.SetBlend(inp)
      

      C++ (part)

      DLLEXPORT int SetBlend(char* a, char* b) 
      { 
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 12/11/2013 at 02:16, xxxxxxxx wrote:

        Solved.
        Apparently, there is something wrong with my class definition.
        Doing it straight solved the issue.

        MyLib.SetBlend.argtypes = [ctypes.c_char_p, ctypes.c_char_p]

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