SWIG vs. uint32_t

classic Classic list List threaded Threaded
3 messages Options
Lev
Reply | Threaded
Open this post in threaded view
|

SWIG vs. uint32_t

Lev
Dear SWIG users/developers,


I am a new user. First of all thank you for the nice tool.

So I wanted to access a member of a structure that have type of
uint32_t, and it faild.

Why is that so? Is there any way using such types as interface
variables?

Thanks,
Levente

--
73 de HA5OGL
Op.: Levente
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Lev
Reply | Threaded
Open this post in threaded view
|

Re: SWIG vs. uint32_t

Lev
Ok, some details.


My structure looks like this:

struct Bind_data {
        uint8_t fid;
        uint8_t chid;
        uint8_t param;
        uint32_t vci;
        uint32_t value;
        uint8_t debug_level;
        char debug_fn[1024];
        char port[512];
};

I use Python as my scripting language, and I access members like this:

import lbus

sensor_data=lbus.Bind_data()
sensor_data.fid=123

I get this:

TypeError: in method 'Bind_data_fid_set', argument 2 of type 'uint8_t'

SWIG Version 3.0.10
Python 3.4.2

Thanks for your help,
Levente

--
73 de HA5OGL
Op.: Levente
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: SWIG vs. uint32_t

William S Fulton


On 20 December 2016 at 21:26, Lev <[hidden email]> wrote:
Ok, some details.


My structure looks like this:

struct Bind_data {
        uint8_t fid;
        uint8_t chid;
        uint8_t param;
        uint32_t vci;
        uint32_t value;
        uint8_t debug_level;
        char debug_fn[1024];
        char port[512];
};

I use Python as my scripting language, and I access members like this:

import lbus

sensor_data=lbus.Bind_data()
sensor_data.fid=123

I get this:

TypeError: in method 'Bind_data_fid_set', argument 2 of type 'uint8_t'

Include the typemaps in the stdint.i library file:

%include <stdint.i>

William

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user