Forum: Ruby mapping C long unsigned integer with swig for ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Amazouz L. (Guest)
on 2008-11-13 18:14
(Received via mailing list)
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
Nobuyoshi N. (Guest)
on 2008-11-13 19:09
(Received via mailing list)
Hi,

At Fri, 14 Nov 2008 01:10:37 +0900,
Lyes A. 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);
Amazouz L. (Guest)
on 2008-11-14 19:50
(Received via mailing list)
On 11/13/08, Nobuyoshi N. <removed_email_address@domain.invalid> wrote:
>
> Nobu Nakada
Ok thank you, I will try that
This topic is locked and can not be replied to.