ctypes different for 32 - 64 bits



  • 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) 
    { 
    


  • 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]


Log in to reply