hi,

my question is,
i am passing a address of variable (string varible) to cpp dll from a python, lets say as below
strvar = create_string_buffer(b"TEST",100)

now wrapping a function called anim, so that i can pass it as callback to cpp dll as parameter
CWRAPPERAnim = CFUNCTYPE(c_voidp,c_char_p,c_int,c_char_p,c_int,c_ char_p,c_long)
wrapped_py_funcCWRAPPERAnim = CWRAPPERAnim(Anim) //Wrapping function anim

now m calling a function from cpp and passing the wrapped function and the byref value of string to cpp dll
CallingCPPFunction(wrapped_py_funcCWRAPPERAnim,"MeterEx.Response.strstatus",byref(strvar)) //Calling cpp Function and sending the required params including wrapped function

function to be wrapped is as follows
def Anim(dp4,strval4): //Function to be wrapped
strresult = str_(strval4)

following functions i hav created so to convert the values returned from cpp to approprieate datatype

def Float_(val):
#INTP = ctypes.POINTER(ctypes.c_int)
#ptr = ctypes.cast(val,INTP)
xyz = struct.pack('i',val)
var2 = struct.unpack('f',xyz)
#print( "Anim xyx-->",xyz,var3)
#var2 = struct.unpack('f',ptr)
#print( "Anim intval1",var2)
return var2[0]

def str_(strval):
#print(strval)
xyz = struct.pack('i',strval)
print("xyz",xyz)
var2 = struct.unpack('10s',xyz)
str2 = str(var2[0])
return str2



def Double_(dblval):
b = c_longlong()
b = cast(dblval,POINTER(c_longlong))
xyz = struct.pack('i',dblval)
#print("xyz-->",xyz)
var2 = struct.unpack('f',xyz)
return var2[0]


when the call reaches to cpp dll, in return it calls the wrapped function with the value stored in the address and passing it to callback function


cpp calls the callbackfunction as follows
# StringValueToBePassed = "this is string value"
objPythonWrappedFunction(dp1value_str(),(*(long *)StringValueToBePassed)); // calling back the python function with values.

..........

i am converting the string value i.e. [StringValueToBePassed] to long value i.e. [*(long *)](then it becomes like ->1835101040)
so now i wish to get that string value back in python from that long converted value.

for that purpose i hac did some code in str_() function. but m not able to achive the output

same i did for float, and its working correct , as i used struct pack and unpack methods.

kindly help to achieve the output.