Hi all.
I just started looking at Python's ctypes lib and I am having trouble
using it for a function.
For starters, here's my Python code:
from ctypes import*;
myStringDLL= cdll.LoadLibrar y("myStringDLL. dll");
GetMyString = getattr(myStrin gDLL,
"?GetMyString@@ YA_NAAV?$basic_ string@DU?$char _traits@D@std@@ V?$allocator@D@ 2@@std@@@Z")
strString = create_string_b uffer('\000' * 256);
GetMyString.res type = c_int;
GetMyString.arg types = [c_char_p];
bResult = GetMyString (strSerialNumbe r);
print (bResult);
print (strSerialNumbe r);
#C++ Prototype of the function I want to call:
#bool GetMyString (string& stringParam) ;
I do not have access to the source code of this function so don't ask
me to try different things in C++. This DLL is working fine.
The problem that I have is that print (strSerialNumbe r) does not seem
to print the correct string. What I get is some garbage value of
unprintable characters. Am I using this the correct way?
Thanks.
I just started looking at Python's ctypes lib and I am having trouble
using it for a function.
For starters, here's my Python code:
from ctypes import*;
myStringDLL= cdll.LoadLibrar y("myStringDLL. dll");
GetMyString = getattr(myStrin gDLL,
"?GetMyString@@ YA_NAAV?$basic_ string@DU?$char _traits@D@std@@ V?$allocator@D@ 2@@std@@@Z")
strString = create_string_b uffer('\000' * 256);
GetMyString.res type = c_int;
GetMyString.arg types = [c_char_p];
bResult = GetMyString (strSerialNumbe r);
print (bResult);
print (strSerialNumbe r);
#C++ Prototype of the function I want to call:
#bool GetMyString (string& stringParam) ;
I do not have access to the source code of this function so don't ask
me to try different things in C++. This DLL is working fine.
The problem that I have is that print (strSerialNumbe r) does not seem
to print the correct string. What I get is some garbage value of
unprintable characters. Am I using this the correct way?
Thanks.
Comment