chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] FFI: wrapping method that returns object


From: Felix Winkelmann
Subject: Re: [Chicken-users] FFI: wrapping method that returns object
Date: Thu, 23 Sep 2004 09:30:39 +0200
User-agent: Mozilla Thunderbird 0.5 (X11/20040208)

Sergey Khorev wrote:
Returning to discussion (complete thread is below for reference)
Does "is not possible" mean, that creating wrapper for

class A
{
public:
  T makeT();
};

in the following form:
T* makeT(A *a)
{
  return new T(a.makeT());
}
will not work? And such a wrapper should return pointer to
gc-collected area? If so, how to achive that? Invoke C_alloc() and
then C_mpointer() to move object to the heap?


Ahem, sorry: I meant using the "T* makeT" wrapper
will work. Your wrapper is the correct way of doing this.
Chicken can currently only pass pointers or numeric values
as arguments to (or results from) C/C++ functions.

If you want to avoid coding, you might write your own little
preprocessor using `foreign-parse/spec' (see the manual):
this macro could (for example) parse the specification, remodel
the interface and generate foreign declarations again.
(This is kind of weird, but actually pretty cool).


cheers,
felix




reply via email to

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