hi,
I have a C++ implemented COM server that give out a method like: int
read(unsigned char* buf, int lenth), How can I use this method from python?
what is the signature?
or anyone can tell me how should I design the COM interface so I can use
python to read a chunk of bytes from a C++ implemented COM server.
thanks. 7 2028
Lin Jingxian wrote: hi, I have a C++ implemented COM server that give out a method like: int read(unsigned char* buf, int lenth), How can I use this method from python? what is the signature?
Have a look at ctypes and/or win32com - they allow you to use COM (in
varying degrees) from Python, so what you're trying to do is probably
possible.
-Dave
Dave Brueck wrote: Have a look at ctypes and/or win32com - they allow you to use COM (in varying degrees) from Python, so what you're trying to do is probably possible.
(Sorry for mis-post... trying again.)
Dave Brueck wrote: Have a look at ctypes and/or win32com - they allow you to use COM (in
^^^^^^^^
Just to note: win32com is part of the "pywin32" package, formerly
called win32all.
varying degrees) from Python, so what you're trying to do is probably possible.
Definitely.. both should work. There are also many examples out there
of using such things for talking via COM, e.g. to automate Internet
Explorer.
-Peter
thanks, Dave and Peter
I can use pythoncom, but since there isn't pointer in python (is it?), I
dont know how to call the : int read(unsigned char* buf, int length) method
in python.what unsigned char* buf should be represented in python?thanks
again.
"Lin Jingxian" <cc******@yahoo.ie> дÈëÓʼþ
news:cg**********@news.yaako.com... hi, I have a C++ implemented COM server that give out a method like: int read(unsigned char* buf, int lenth), How can I use this method from
python? what is the signature? or anyone can tell me how should I design the COM interface so I can use python to read a chunk of bytes from a C++ implemented COM server.
thanks.
Hello Lin, I have a C++ implemented COM server that give out a method like: int read(unsigned char* buf, int lenth), How can I use this method from python? what is the signature? or anyone can tell me how should I design the COM interface so I can use python to read a chunk of bytes from a C++ implemented COM server.
You can avoid COM and either get this server as a Python module using
SWIG/Boost.Python/Pyrex ...
You can also use a regular DLL using ctypes package.
However if you *must* use COM then make sure your server has a Dispatch
interface and just use win32com.client.Dispatch to create and use it.
Bye.
--
------------------------------------------------------------------------
Miki Tebeka <mi*********@zoran.com> http://tebeka.spymac.net
The only difference between children and adults is the price of the toys
Lin Jingxian wrote: thanks, Dave and Peter I can use pythoncom, but since there isn't pointer in python (is it?), I dont know how to call the : int read(unsigned char* buf, int length) method in python.what unsigned char* buf should be represented in python?thanks again.
I think Miki's answer is probably on target for doing that from
pythoncom. That is, don't, but use the Dispatch interface instead.
From ctypes, however, you can create special objects which ctypes can
use as pointer types. For example, byref(sometype) is roughly
equivalent to "sometype * xxx" when using ctypes.
-Peter
Peter Hansen wrote: From ctypes, however, you can create special objects which ctypes can use as pointer types. For example, byref(sometype) is roughly equivalent to "sometype * xxx" when using ctypes.
Oh, and I should mention that there is a dedicated mailing list
for ctypes so, after you have experimented a bit and read the
docs yourself, you should probably direct ctypes questions there
instead of here, for greatest effect.
-Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Nicolas Lehuen |
last post by:
Hi,
Is it me, or does anyone else get significantly better pystone results under
Cygwin versus the standard Win32 build ?
CYGWIN 1.5.6 + python 2.3.3-1 :
$ time python...
|
by: Jorgen Grahn |
last post by:
I couldn't think of a good solution, and it's hard to Google for...
I write python command-line programs under Win2k, and I use the bash shell
from Cygwin. I cannot use Cygwin's python package...
|
by: Jed R. Mallen |
last post by:
Hello,
Can anyone point me to a nice tute on making python apps for win32?
TIA
|
by: Brian Beck |
last post by:
As far as I can tell, both maintainers of the Windows builds of
Python-LDAP haven't updated in about a year. This doesn't exactly
make the builds ancient or obsolete, but it would be nice to start...
|
by: Grant Edwards |
last post by:
I finally figured out why one of my apps sometimes fails under
Win32 when it always works fine under Linux: Under Win32, the
pickle module only works with a subset of floating point
values. In...
|
by: Christopher Subich |
last post by:
From the documentation, it looks like DParser-python will do what I
need, but I'm having trouble getting it installed properly. I'm using a
win32 environment, with official 2.4 Python binaries.
...
|
by: dumpingrounds |
last post by:
Hi,
I must be going nutty, but I can't seem to find anywhere where I can
get just the binaries for, say, 2.3.5 for win32. I've googled high and
low and all I come up with is installer (MSI/EXE)...
|
by: Srijit Kumar Bhadra |
last post by:
I have browsed the following links
1) http://peak.telecommunity.com/DevCenter/EasyInstall
2) When Python *Eggs* better than Python *distutils*?? What's Eggs?
(http://tinyurl.com/m8dyd)
But I am...
|
by: Pierre Rouleau |
last post by:
Hi all,
When using Python 2.4.x on a Win32 box,
marshal.loads(marshal.dumps(1e66666)) returns 1.0 instead of infinity
as it should and does under Python 2.5 (also running on Win32 ).
This...
|
by: lixinyi.23 |
last post by:
Hi!
I'm currently working on a scientific computation software built in
python.
What I want to implement is a Matlab style command window <->
workspace interaction.
For example, you type...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |