This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Closures without VA-stuff
- From: "Jonathan Schmidt-Dominé - Developer" <devel at the-user dot org>
- To: libffi-discuss at sources dot redhat dot com
- Date: Sun, 20 Dec 2009 02:20:22 +0100
- Subject: Closures without VA-stuff
- Reply-to: devel at the-user dot org
Hi!
I am seeking a library providing a very simple feature like this:
int test(void *d, int x);
int main()
{
struct data
{
int a, b;
};
data d;
int(*fun)(int) = create_closure(test, &d);
fun(4); // invokes test(d, 4)
}
So I have found two libraries: ffcall and libffi.
Such things are possible with libffi (and even ffcall), but there is no way to
do simply that, you always need this "varaidic stuff". Why isn't there any
simple function to create closures? Any suggestions what I should try to do?
I am asking you, because libffi looks promising. ;)
Jonathan
------------------------
Operating System: GNU/Linux
Kernel: Linux 2.6.31.5-0.1-default
Distribution: openSuSE 11.2
Qt: 4.6.1
KDE Development Platform: 4.3.82 (KDE 4.3.82 (KDE 4.4 >= 20091211)) "release
1"
KMail: 1.13.0
http://gnu.org/
http://kde.org/
http://windows7sins.org/