guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about `smob' generated by swig


From: William Xu
Subject: Re: about `smob' generated by swig
Date: Wed, 28 Mar 2007 16:17:09 +0800
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

"Marco Maggi" <address@hidden> writes:

> "William Xu" wrote:
>> Swig could generate pointer types  in C to smob. But users
>> still  have to define  smob related  operations(like mark,
>> free, etc) by hand?
>
> Mh, no.   I have never used SWIG  but if I read  [1] and [2]
> and   by   inspecting   "Examples/guile"   in   the   source
> distribution  of SWIG  1.3.31,  it seems  to  me that  every
> unknown data type used  as parameter to functions is treated
> like a pointer.
>
> [1] <http://www.swig.org/Doc1.1/HTML/SWIG.html#n3>
> [2] "swig-1.3.31/Doc/Manual/Guile.html"
>
>   That is: SWIG generates a SMOB holding two values:
>
> 1 - the pointer to the data instance;
> 2 - a string holding the name of the unknown type;

Yes, it's more like a smob type pointer. Consider this, 

    void bar(unsigned char *s)
    {
         printf("s = %s\n", s);
    }
    
One problem is that how i create and pass a `unsigned char*' parameter
to `bar'. If SWIG requires me to write smob creation myself, that's a
pain...

>   By the way: to write a SMOB driver is not difficult if
> you know some C language. Are you sure that you need
> SWIG?

As we know, one of guile or scheme's big shortcomings is lack of
libraries. On the contrary, C libraries are pretty full. Hence, if SWIG
can do a good job on wrapping C codes for guile, that would really be
great..

-- 
William

I used to be disgusted, now I find I'm just amused.
                -- Elvis Costello




reply via email to

[Prev in Thread] Current Thread [Next in Thread]