ctypes restype error! Programming Software Development by Stefano Mtangoo … the code [CODE=python] #import ctypes module import ctypes as ct #get BOOL C++ value from ctypes from ctypes.wintypes import BOOL #Loading the… Re: Ctypes question Programming Software Development by vegaseat …[code=python]# using the module ctypes you can access DLLs written in C/C++ # ctypes converts between Python types and C…and VB may use stdcall, import with windll # module ctypes is built into Python25 and higher # look under… ctypes in the Python manual from ctypes import * # as an example let's… Re: Ctypes data equivalent to C++ BOOL?? Programming Software Development by pmf A word of warning, be careful using ctypes.wintypes.BOOL as a C++ bool equivalent. From the …documentation at [url]http://epydoc.sourceforge.net/stdlib/ctypes.wintypes-module.html[/url] BOOL is described as a c_long…currently having problems with memory access violations when passing a ctypes.wintypes.BOOL to a DLL and I wouldn't be… Ctypes question Programming Software Development by Stefano Mtangoo I have been trying to learn ctypes so as I can call C++ DLLs in python and … is my code for Loading the DLL : [CODE=python] import ctypes as ct #load DLL dll = ct.cdll.test_dll print dll… Re: Ctypes question Programming Software Development by Stefano Mtangoo I read somewhere an article on ctypes and made life easier. However, I still don't know where to use pointers and where to use other ctypes variables like c_char, c_int etc. Anyone to help? Ctypes data equivalent to C++ BOOL?? Programming Software Development by Stefano Mtangoo What is ctypes data for BOOL? I mean in C++ to ctypes we have: int--> c_int float--> c_float what about BOOL? ctypes - pointer to array of doubles? Programming Software Development by trayres … can't...figure out how to make it work with ctypes. I'd be trying to retrieve the values, that start…() gives me an error. I've only been working with ctypes for two days, and am stuck. Any help is really… Re: Ctypes question Programming Software Development by Stefano Mtangoo …. Can someone give me a start. I cannot find the ctypes variable equivalent of BOOL, QWORD etc. And also how to… Re: Ctypes question Programming Software Development by Stefano Mtangoo I have failed to re-write the function in python because I don't know how to convert QWORD offset, and BOOLto ctypes. Someone help me please! Re: Ctypes question Programming Software Development by Stefano Mtangoo Anyone who knows QWORD, DWORD and BOOL ctypes Equivalents. I find c_int, c_float etc but not the Equivalent above! Re: Ctypes data equivalent to C++ BOOL?? Programming Software Development by Stefano Mtangoo I got it! [CODE=python] from ctypes.wintypes import BOOL #then you can use BOOL anywhere in your code [/CODE] ctypes and speed Programming Software Development by OffbeatPatriot … by calling a method written in python, then I remembered ctypes. So I wanted to ask, is PyObject_CallObject(my_callback, NULL) any… Re: ctypes and speed Programming Software Development by OffbeatPatriot Do you know what the over head is? Also, using the ctypes module, or anything really, can I get a C function pointer? Re: ctypes and speed Programming Software Development by OffbeatPatriot "Do you know what the over head is?" I think I'll rephrase that. I'm fairly new to learning about the mechanisms of what makes python work so maybe this is a stupid question, but if a PyObject is basically a ctypes wrapper for a c function is the python interpreter ever used when I call PyObject_CallObject on it? Re: ctypes help Programming Software Development by Tech B … pointers on google, would something like this work? [CODE] graydata = ctypes.cast(graydata, ctypes.POINTER(ctypes.c_ubyte)) [/CODE] Re: ctypes help Programming Software Development by Tech B … up the stack. "([URL="http://old.nabble.com/ctypes-with-Compaq-Visual-Fortran-6.6B-*.dll-(Windows-XP),-passing… up the stack."([URL="http://old.nabble.com/ctypes-with-Compaq-Visual-Fortran-6.6B-*.dll-(Windows-XP),-passing… Re: ctypes help Programming Software Development by The_Kernel I don't think you can just dump a python array into the dll's function. Try initializing graydata like this: [code] graydata_type = ctypes.c_ubyte * (w * h) graydata = graydata_type()[/code] Re: ctypes help Programming Software Development by Tech B … sure it works. Bascialy what I do is: [CODE] form ctypes import * fd = windll.LoadLibrary('fdlib.dll') import Image im = Image… Passing pointer to array of structures in ctypes Programming Software Development by runge_kutta …;z", ctypes.c_double), ("a", ctypes.c_double), ("e", ctypes.c_double), ("r", ctypes.c_double), ("time", ctypes.c_double), ("… Re: Passing pointer to array of structures in ctypes Programming Software Development by Gribouillis I think you create an array like this [code=python] arr = (pyMyStructure * 4)() [/code] but I'm a beginner in ctypes. Perhaps you can pass [icode]ctypes.pointer(arr)[/icode] to your function. Re: Passing pointer to array of structures in ctypes Programming Software Development by runge_kutta Hi! Yeah Gribouillis - the solution I ended up with was along those lines: [CODE] recordPointerType = structures.pyDoubleMeasuresRecord * 4 record = recordPointerType() recordPointer = ctypes.pointer(record) [/CODE] I liked yours better, so that's what ended up in the code. Thanks Gribouillis! Python and ctypes, an exercise Programming Software Development by Diomedes … implementing a simple, singly linked list in python using ctypes [code] from ctypes import * class linknode(Structure): pass linknode._fields_ = [ ("… linked_list(): """ our own linked list based on ctypes """ head_node = None def add(self, int_data): … using ctypes to access a dll created by scons Programming Software Development by i_saw_some … from the cpp file? Thanks! -Vic [ICODE] from ctypes import * c = cdll.LoadLibrary("hello.dll") …gt; print c.rr File "C:\Python25\lib\ctypes\__init__.py", line 361, in __getattr__ func =… self.__getitem__(name) File "C:\Python25\lib\ctypes\__init__.py", line 366, in __getitem__ func = … Re: Python and ctypes, an exercise Programming Software Development by TrustyTony …*name; struct cell *next; } cell;The straightforward translation into ctypes code would be this, but it does not work: >… available in the class statement itself. [U]In ctypes, we can define the cell class and set the…later, after the class statement: [/U] >>> from ctypes import * >>> class cell(Structure): ... pass ... … Re: Python and ctypes, an exercise Programming Software Development by TrustyTony … post) in objects the limitation still stays same [CODE] from ctypes import * import sys, random class linknode(Structure): pass linknode._fields_…;, c_int), ] class linked_list(): """ linked list based on ctypes implements __iter__ and __len__ methods and add method to putting… Re: Python and ctypes, an exercise Programming Software Development by leegao Hi, [code] from ctypes import * from see import see import sys class linknode(Structure): … linked_list(): """ our own linked list based on ctypes """ head_node = None def add(self, int_data): node_to_add… how to get the interface from win dll by ctypes Programming Software Development by newharvar hi,everybody I am study ctypes,and got a big trouble,I googled lots a pages but get no usefull info. i want to know how to get the interface from winxp by using ctypes, for example: I want to use ActiveDesktop 's interface by using ctypes,but i don't know how to do,can anybody help me? thanks alot~ Re: Python and ctypes, an exercise Programming Software Development by TrustyTony Here my analysis of the problem [CODE] from ctypes import * class cell(Structure): pass cell._fields_ = [("name", … Accessing ctypes array object data... help! Programming Software Development by convoluted …figure out how to access data I input into a ctypes array object. This is used with a hardware SDK… data format at all. Here's the code: [CODE] from ctypes import * MsgDataType = c_uint8 * 8 msg = MsgDataType() msg[0] = …;[/I] Typing "pt" outputs: [I]<ctypes.LP_c_ubyte_Array_8 object at 0x00F58A80>[/I] I've also tried… accessing functions from a dll using python ctypes Programming Software Development by dilbert_here00 …to access some functions from a dll using python ctypes, but not sure how to pass pointers to… items filled into the array. I tried the following: from ctypes import * device_list_size = 5 device_list = [] dll = cdll.LoadLibrary…: _type_ must have storage info I am new to ctypes so not sure if this is correct, I would …