472,353 Members | 1,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Re: Is ctypes appropriate in my case?

du**********@gmail.com wrote:

On Wed, Oct 29, 2008 at 6:51 PM, Terry Reedy <tj*****@udel.edu

du**********@gmail.com <mailto:du**********@gmail.comwrote:


I've a dll and its header file that controls an hardware. I want
to write a wrapper for this dll in Python.
What is the best way that I can write a wrapper?
What do you want to do with the wrapper?
I'm intending to use STAF - software testing automation framework where
I want to test this dll. Test cases for STAF are written in xml and
python. So for this I want to write a wrapper class for this dll in
python that has Dll API's as the member function of the wrapper class.

This class will be in a python module. This module can be then be
imported in the test cases thereby exposing the dll APIs for testing.

Please suggest if there are better solutions around.

I know ctypes modules and have used it before. As far as I know
ctypes is only used to call the dll functions in a python module.
I am not sure what you mean here. Python code can directly import
and call functions in dlls that represent Python extension modules
and that are placed in the Pythonxx/dlls directory in your Windows
Python installation. Ctypes is mostly used to call functions in a
dll that is *not* a python extension module, that was not written
for Python.


Well I did not know this. What is a Python extension module?
For CPython, an importable module written in C. There is a doc
Extending and Embedding the Python Interpreter. But I expect you can
write the class in Python with ctypes.

Oct 30 '08 #1
0 1306

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: wccppp | last post by:
Hello, I'm a complete newbie in learning python. I was testing some sample codes I found in this newsgroup and seems it could not locate the...
by: p.lavarre | last post by:
How do I vary the byte offset of a field of a ctypes.Structure? How do I "use the dynamic nature of Python, and (re-)define the data type after...
by: Terry Reedy | last post by:
dudeja.rajat@gmail.com wrote: What do you want to do with the wrapper? I am not sure what you mean here. Python code can directly import and...
by: Terry Reedy | last post by:
dudeja.rajat@gmail.com wrote: Ugh ;-) I have the impression that SWIG has multiple backends for different languages. There is one for...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.