mapping C long unsigned integer with swig for ruby

L

Lyes Amazouz

[Note: parts of this message were removed to make it a legal post.]

Hi everyone

I want to now how can I indicate to swig to consider a n unsigned long long
function input/output parameter as a ruby BigNum object.

with python, we use the typemap to do the conversion.: for example

/* Convert from Python --> C */
%typemap(in) int {
$1 = PyInt_AsLong($input);
}

/* Convert from C --> Python */
%typemap(out) int {
$result = PyInt_FromLong($1);

is there something equivalent with ruby

thank you
 
N

Nobuyoshi Nakada

Hi,

At Fri, 14 Nov 2008 01:10:37 +0900,
Lyes Amazouz wrote in [ruby-talk:320166]:
I want to now how can I indicate to swig to consider a n unsigned long long
function input/output parameter as a ruby BigNum object.
Maybe:

/* Convert from Python --> C */
%typemap(in) int { $1 = ULL2NUM($input);
}

/* Convert from C --> Python */
%typemap(out) int {
$result = NUM2ULL($1);
 
L

Lyes Amazouz

[Note: parts of this message were removed to make it a legal post.]

Hi,

At Fri, 14 Nov 2008 01:10:37 +0900,
Lyes Amazouz wrote in [ruby-talk:320166]:
I want to now how can I indicate to swig to consider a n unsigned long long
function input/output parameter as a ruby BigNum object.
Maybe:

/* Convert from Python --> C */
%typemap(in) int { $1 = ULL2NUM($input);
}

/* Convert from C --> Python */
%typemap(out) int {
$result = NUM2ULL($1);



Ok thank you, I will try that
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top