473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

ctypes & Wrapping Complex Datatypes

Hi,

I've just started using ctypes and so far, its great. But I'm running
to some problems with complex datatypes. I'm not sure how to wrap
something like this:

/* This defines the Handle type in a header file. I don't think
this needs wrapping, its just to show the handle definition for
context*/
typedef struct DFFTSHandle_s *DFFTSHANDLE;
....
/* Then, the handle is used like this later on. This *is* what I
want to wrap.*/
status = DFFTSCreateSession(&Handle);
status = DFFTSSetSessionOption(Handle, DFFTSOPT_ITERATIONS,
&iteration, sizeof(iteration));
Any ideas?

Oct 16 '07 #1
2 1651
On Tue, 16 Oct 2007 06:47:06 -0700, gamename wrote:
I've just started using ctypes and so far, its great. But I'm running
to some problems with complex datatypes. I'm not sure how to wrap
something like this:

/* This defines the Handle type in a header file. I don't think
this needs wrapping, its just to show the handle definition for
context*/
typedef struct DFFTSHandle_s *DFFTSHANDLE;
...
/* Then, the handle is used like this later on. This *is* what I
want to wrap.*/
status = DFFTSCreateSession(&Handle);
status = DFFTSSetSessionOption(Handle, DFFTSOPT_ITERATIONS,
&iteration, sizeof(iteration));
If this "handle" is always just treated as a pointer to an opaque data
structure you may just use a void pointer.

Ciao,
Marc 'BlackJack' Rintsch
Oct 16 '07 #2
On Oct 16, 6:52 am, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
On Tue, 16 Oct 2007 06:47:06 -0700, gamename wrote:
I've just started using ctypes and so far, its great. But I'm running
to some problems with complex datatypes. I'm not sure how to wrap
something like this:
/* This defines the Handle type in a header file. I don't think
this needs wrapping, its just to show the handle definition for
context*/
typedef struct DFFTSHandle_s *DFFTSHANDLE;
...
/* Then, the handle is used like this later on. This *is* what I
want to wrap.*/
status = DFFTSCreateSession(&Handle);
status = DFFTSSetSessionOption(Handle, DFFTSOPT_ITERATIONS,
&iteration, sizeof(iteration));

If this "handle" is always just treated as a pointer to an opaque data
structure you may just use a void pointer.

Ciao,
Marc 'BlackJack' Rintsch
OK. Thanks.
-T

Oct 16 '07 #3

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

Similar topics

2
by: Thomas Heller | last post by:
It's release day ;-) ctypes 0.6.3 released ===================== Overview 'ctypes' is a Python package to create and manipulate C data types in Python, and to call functions in dynamic...
19
by: Thomas Heller | last post by:
ctypes 0.9.2 released - Oct 28, 2004 ==================================== Overview ctypes is a ffi (Foreign Function Interface) package for Python 2.3 and higher. ctypes allows to call...
3
by: aaa | last post by:
I am having trouble getting a complex data type to get passed to a non-COM dll's function by ref and return back data from that object. Simple data types work fine but when I try the complex data...
3
by: Martin P. Hellwig | last post by:
Hey all, I'd like to wrap libpam so that I can use that for authentication and password management. I build ctypes (0.9.9.6) on my platform via ports. Now according to OpenPAM documentation...
5
by: Oliver Andrich | last post by:
Hi, hopefully someone with some ctypes experience can help me. I guess this is a trivial task again, but I have been googling, reading, experimenting the whole afternoon without any success. ...
1
by: sjdevnull | last post by:
Hey, I'm trying to wrap GNU readline with ctypes (the Python readline library doesn't support the callback interface), but I can't figure out how to set values to a variable inside the library. ...
3
by: Chris AtLee | last post by:
Sorry for the repeat post...I'm not sure if my first post (on May 30th) went through or not. I've been trying to write a PAM module using ctypes. In the conversation function (my_conv in the...
0
by: Eugen Wintersberger | last post by:
Hi there I want to use ctypes in connection with C functions that use complex datatypes defined in the C99 standard. Does someone know a simple way how to implement this? Are there any plans to...
0
by: gamename | last post by:
Hi, I've just started using ctypes and so far, its great. But I'm running to some problems with complex datatypes. I'm not sure how to wrap something like this: /* This defines the Handle...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.