chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Re: FFI to libgmp questions


From: Peter Keller
Subject: Re: [Chicken-users] Re: FFI to libgmp questions
Date: Mon, 1 Jul 2002 22:58:50 -0500
User-agent: Mutt/1.2i

On Sun, Jun 30, 2002 at 07:56:50PM +0200, felix wrote:
> (define-foreign-type ptr-array ptr-array->ptr ptr->ptr-array)
> 
> As long as you provide conversion procedures, you can transform your
> arguments and result to/from foreign code as you like. The basic FFI
> just provides special handling of strings, byte-vectors and SRFI-4 
> number-vectors.
> For your own converters, you have to do the freeing per hand of course.

Maybe the manual or examples directory should have some examples of this.
If you help me figure out how to do it, I'd be glad to make a few examples that
you could include with the distribution on how to do it.

> Well, it *is* confusing! The documentation is rather weak. And I'm not 
> particularly
> good in explaining these things. 
> To add to the confusion, let me say that the foreign type `scheme-object'
> has some interesting properties: It allows you to

Yikes! I think I'll hold off on learning that stuff until I figure out what
I haven't learned already. :)

So, I have another question:

Suppose in a file (s_gmp_integer_ffi.scml) I'm using:
(declare (unit gmp-integer) (uses gmp-utils))
(declare
    (foreign-declare "#include <gmp.h>"))
[ function definitions ]

at the top of a FFI to the integer functions in libgmp. Now, in this file
(s_gmp_utils.scml) I have this:

(declare (unit gmp-utils))
(declare
    (foreign-declare "#include <gmp.h>"))
(define-foreign-type mpz_t
    (pointer "__mpz_struct"))

When compiling, I get "unknown type mpz_t" in the s_gmp_integer_ffi.scml
file.

The question is, how come foreign functions are automatically exported
to the world, but not foreign types? Or, most likely, what am I doing wrong?

Thank you.

-pete



reply via email to

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